diff options
| author | Vishmita <vja@tinyerp.com> | 2012-11-20 18:01:31 +0530 |
|---|---|---|
| committer | Vishmita <vja@tinyerp.com> | 2012-11-20 18:01:31 +0530 |
| commit | b8836ee8092286c69b89bf2687fed001fdfbb2d0 (patch) | |
| tree | 1f541b671cdf4b70f7bf696c427242956fd21571 /addons/web/controllers/main.py | |
| parent | 3b07266500b246717a25a09491b548bc571c66a9 (diff) | |
[IMP]Set Priority to display warning messages for change password dialog
bzr revid: vja@tinyerp.com-20121120123131-9boe1y6ki0sy2h3c
Diffstat (limited to 'addons/web/controllers/main.py')
| -rw-r--r-- | addons/web/controllers/main.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 0155d4149a2..181bb31d43e 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -891,15 +891,19 @@ class Session(openerpweb.Controller): dict(map(operator.itemgetter('name', 'value'), fields))) if not (old_password.strip() and new_password.strip() and confirm_password.strip()): return {'error':'You cannot leave any password empty.','title': 'Change Password'} + user_pwd = req.session.model('res.users').read([req.session._uid], ['password'], None)[0]['password'] try: - if req.session.model('res.users').change_password( - old_password, new_password): - return {'new_password':new_password} + if old_password == user_pwd: + if old_password == new_password: + return {'error':'New password must be different from the old password. Please try again.','title': 'Change Password'} + elif new_password != confirm_password: + return {'error': 'The new password and its confirmation must be identical.','title': 'Change Password'} + elif req.session.model('res.users').change_password(old_password, new_password): + return {'new_password':new_password} + else: + return {'error': 'The Old Password you provided is incorrect. Please try again.', 'title': 'Change Password'} except Exception: - return {'error': 'The Old Password you provided is incorrect. Please try again.', 'title': 'Change Password'} - if new_password != confirm_password: - return {'error': 'The new password and its confirmation must be identical.','title': 'Change Password'} - return {'error': 'Error, password not changed !', 'title': 'Change Password'} + return {'error': 'Error, password not changed !', 'title': 'Change Password'} @openerpweb.jsonrequest def sc_list(self, req): |
