diff --git a/sao/CHANGELOG b/sao/CHANGELOG index d28366f1b2..1c53037a99 100644 --- a/sao/CHANGELOG +++ b/sao/CHANGELOG @@ -1,3 +1,4 @@ +* Allow resetting forgotten password Version 7.0.0 - 2023-10-30 -------------------------- diff --git a/sao/src/session.js b/sao/src/session.js index 5f6380777a..ab2d667e4f 100644 --- a/sao/src/session.js +++ b/sao/src/session.js @@ -87,6 +87,23 @@ } return prm; }, + do_reset_password: function() { + if (!this.login) { + return jQuery.when(); + } + const args = { + 'id': 0, + 'method': 'common.db.reset_password', + 'params': [this.login, Sao.i18n.getlang()], + }; + return jQuery.ajax({ + 'contentType': 'application/json', + 'data': JSON.stringify(args), + 'dataType': 'json', + 'url': '/' + this.database + '/', + 'type': 'post', + }); + }, reload_context: function() { var args = { 'method': 'model.res.user.get_preferences', @@ -518,7 +535,37 @@ return Sao.common.ask.run(message, name); }, get_password: function(message, name) { - return Sao.common.ask.run(message, name, false); + const session = this.session; + const AskPasswordDialog = Sao.class_(Sao.common.AskDialog, { + build_dialog: function(question, name, visibility, prm) { + const dialog = AskPasswordDialog._super.build_dialog.call( + this, question, name, visibility, prm); + jQuery('