fix in change password of profile settings page

This commit is contained in:
Anand Doshi 2012-08-27 15:49:27 +05:30
parent 9ee4adb27a
commit ebcb8b3fac

View File

@ -34,11 +34,14 @@ def change_password(arg):
check_demo() check_demo()
arg = load_json(arg) arg = load_json(arg)
if not webnotes.conn.sql('select name from tabProfile where name=%s and password=password(%s)', (webnotes.session['user'], arg['old_password'])): if not webnotes.conn.sql("""select * from `__Auth` where `user`=%s
and password=password(%s)""",
(webnotes.session["user"], arg["old_password"])):
webnotes.msgprint('Old password is not correct', raise_exception=1) webnotes.msgprint('Old password is not correct', raise_exception=1)
from webnotes.utils import nowdate webnotes.conn.sql("""update `__Auth` set password=password(%s)
webnotes.conn.sql("update tabProfile set password=password(%s), modified=%s where name=%s",(arg['new_password'], nowdate(), webnotes.session['user'])) where `user`=%s""", (arg["new_password"], webnotes.session["user"]))
webnotes.msgprint('Password Updated'); webnotes.msgprint('Password Updated');
@webnotes.whitelist() @webnotes.whitelist()