diff options
| author | Raphael Collet <rco@openerp.com> | 2012-12-03 15:44:24 +0100 |
|---|---|---|
| committer | Raphael Collet <rco@openerp.com> | 2012-12-03 15:44:24 +0100 |
| commit | 41ceffd52b8c5cb606c1a57d2985f57eec2a3926 (patch) | |
| tree | 4e9d7ab901bb38abeeec0e86cf353937b0f64360 /addons/auth_signup/static/src/js | |
| parent | 772a721d854e18d944453419b04fc01d7667f5e5 (diff) | |
[ADD] auth_signup: merge in functionality of auth_reset_password
bzr revid: rco@openerp.com-20121203144424-39wrr5z78smswox2
Diffstat (limited to 'addons/auth_signup/static/src/js')
| -rw-r--r-- | addons/auth_signup/static/src/js/auth_signup.js | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/addons/auth_signup/static/src/js/auth_signup.js b/addons/auth_signup/static/src/js/auth_signup.js index 241c2406d56..562332556ab 100644 --- a/addons/auth_signup/static/src/js/auth_signup.js +++ b/addons/auth_signup/static/src/js/auth_signup.js @@ -43,8 +43,13 @@ openerp.auth_signup = function(instance) { .fail(self.on_token_failed) }); } + + // bind reset password link + this.$('a.oe_reset_password').click(this.do_reset_password); + return d; }, + on_token_loaded: function(result) { // select the right the database this.selected_db = result.db; @@ -66,6 +71,7 @@ openerp.auth_signup = function(instance) { this.$("form input[name=login]").val(result.login || ""); } }, + on_token_failed: function(result, ev) { if (ev) { ev.preventDefault(); @@ -74,6 +80,7 @@ openerp.auth_signup = function(instance) { delete this.params.db; delete this.params.token; }, + on_submit: function(ev) { if (ev) { ev.preventDefault(); @@ -124,6 +131,26 @@ openerp.auth_signup = function(instance) { this._super(ev); } }, - }); + do_reset_password: function(ev) { + if (ev) { + ev.preventDefault(); + } + var db = this.$("form [name=db]").val(); + var login = this.$("form input[name=login]").val(); + if (!db) { + this.do_warn("Login", "No database selected !"); + return false; + } else if (!login) { + this.do_warn("Login", "Please enter a username or email address.") + return false; + } + var params = { + dbname : db, + login: login, + }; + var url = "/auth_signup/reset_password?" + $.param(params); + window.location = url; + }, + }); }; |
