diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 07ad37923d8..ad5dd21d0d8 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -897,7 +897,7 @@ class Session(openerpweb.Controller): old_password, new_password,confirm_password = operator.itemgetter('old_pwd', 'new_password','confirm_pwd')( dict(map(operator.itemgetter('name', 'value'), fields))) if not (old_password.strip() and new_password.strip() and confirm_password.strip()): - return {'error':'All passwords have to be filled.','title': 'Change Password'} + return {'error':'You cannot leave any password empty.','title': 'Change Password'} if new_password != confirm_password: return {'error': 'The new password and its confirmation must be identical.','title': 'Change Password'} try: @@ -905,7 +905,7 @@ class Session(openerpweb.Controller): old_password, new_password): return {'new_password':new_password} except Exception: - return {'error': 'Original password incorrect, your password was not changed.', 'title': 'Change Password'} + return {'error': 'The old password you provided is incorrect, your password was not changed.', 'title': 'Change Password'} return {'error': 'Error, password not changed !', 'title': 'Change Password'} @openerpweb.jsonrequest diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 7829a3e0cc7..af05ae59111 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -765,20 +765,24 @@ instance.web.ChangePassword = instance.web.Widget.extend({ template: "ChangePassword", start: function() { var self = this; - self.$el.validate({ - submitHandler: function (form) { - self.rpc("/web/session/change_password",{ - 'fields': $(form).serializeArray() - }).done(function(result) { - if (result.error) { - self.display_error(result); - return; - } else { - instance.webclient.on_logout(); - } - }); - } - }); + this.getParent().dialog_title = "Change Password"; + var $button = self.$el.find('.oe_form_button'); + $button.appendTo(this.getParent().$buttons); + $button.eq(2).click(function(){ + self.getParent().close(); + }) + $button.eq(0).click(function(){ + self.rpc("/web/session/change_password",{ + 'fields': $("form[name=change_password_form]").serializeArray() + }).done(function(result) { + if (result.error) { + self.display_error(result); + return; + } else { + instance.webclient.on_logout(); + } + }); + }) }, display_error: function (error) { return instance.web.dialog($('
'), { diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 6476462ff19..fb0ba93afa0 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -315,26 +315,32 @@
+
- - + - - + - - + - +
+ + or + +
+