diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-04-14 22:52:45 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-04-14 22:52:53 -0700 |
commit | 67230fe32f1c18517c334aa2293841c4a531b45e (patch) | |
tree | 90cb018749285de7fcd4476b5acc74fdc0915f9a /web/app/controller/Root.js | |
parent | bfe5b547bc7c6dee70fc95034a175a5c9d8012af (diff) | |
download | trackermap-web-67230fe32f1c18517c334aa2293841c4a531b45e.tar.gz trackermap-web-67230fe32f1c18517c334aa2293841c4a531b45e.tar.bz2 trackermap-web-67230fe32f1c18517c334aa2293841c4a531b45e.zip |
Implement password reset
Diffstat (limited to 'web/app/controller/Root.js')
-rw-r--r-- | web/app/controller/Root.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index 81efe115..c16fd37a 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -105,6 +105,7 @@ Ext.define('Traccar.controller.Root', { }, onSessionReturn: function (options, success, response) { + var passwordReset, dialog; Ext.get('spinner').setVisible(false); if (success) { Traccar.app.setUser(Ext.decode(response.responseText)); @@ -117,6 +118,33 @@ Ext.define('Traccar.controller.Root', { } }); this.login.show(); + + passwordReset = Ext.Object.fromQueryString(window.location.search).passwordReset; + if (passwordReset) { + dialog = Ext.Msg.prompt(Strings.loginReset, Strings.userPassword, function (btn, text) { + dialog.textField.inputEl.dom.type = 'text'; + if (btn == 'ok') { + Ext.Ajax.request({ + scope: this, + method: 'POST', + url: 'api/password/update', + params: { + token: passwordReset, + password: text + }, + callback: function (options, success, response) { + if (success) { + Traccar.app.showToast(Strings.loginUpdateSuccess); + this.removeUrlParameter('passwordReset'); + } else { + Traccar.app.showError(response.responseText); + } + } + }); + } + }, this); + dialog.textField.inputEl.dom.type = 'password'; + } } }, |