From 3a483b32e8df1a0f0351c0b9e028b31762b97a32 Mon Sep 17 00:00:00 2001 From: Nijil Y Date: Thu, 13 Oct 2011 15:11:23 +0530 Subject: [PATCH] Remove extra popup message in login validation --- py/core/page/login_page/login_page.js | 7 ++++--- py/webnotes/auth.py | 10 +++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/py/core/page/login_page/login_page.js b/py/core/page/login_page/login_page.js index ac8dfd573b..cfd8b72092 100644 --- a/py/core/page/login_page/login_page.js +++ b/py/core/page/login_page/login_page.js @@ -17,8 +17,9 @@ pscript.onLoginReply = function(r, rtext) { pscript.login_btn.done_working(); if(r.message=="Logged In"){ window.location.href='index.html' + (get_url_arg('page') ? ('?page='+get_url_arg('page')) : ''); - } else { - $i('login_message').innerHTML = ''+eval(r.message)+''; + } else{ + + $i('login_message').innerHTML = ''+r.message+''; //if(r.exc)alert(r.exc); } } @@ -53,4 +54,4 @@ pscript.show_forgot_password = function(){ } d.show(); pscript.forgot_dialog = d; -} \ No newline at end of file +} diff --git a/py/webnotes/auth.py b/py/webnotes/auth.py index 6858151560..a853c177b4 100644 --- a/py/webnotes/auth.py +++ b/py/webnotes/auth.py @@ -139,8 +139,10 @@ class LoginManager: user, pwd = webnotes.form_dict.get('usr'), webnotes.form_dict.get('pwd') if not (user and pwd): - webnotes.msgprint('Incomplete Login Details', raise_exception=1) - + webnotes.response['message'] = 'Incomplete Login Details' + raise ValidationError + #webnotes.msgprint('Incomplete Login Details', raise_exception=1) + # custom authentication (for single-sign on) self.load_control_panel() if hasattr(self.cp, 'authenticate'): @@ -153,7 +155,9 @@ class LoginManager: p = webnotes.conn.sql("select name from tabProfile where name=%s and (`password`=%s OR `password`=PASSWORD(%s)) and IFNULL(enabled,0)=1", (user, pwd, pwd)) if not p: - webnotes.msgprint('Authentication Failed', raise_exception=1) + webnotes.response['message'] = 'Authentication Failed' + raise ValidationError + #webnotes.msgprint('Authentication Failed',raise_exception=1) self.user = p[0][0]