aboutsummaryrefslogtreecommitdiff
path: root/web/app/controller/Root.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/controller/Root.js')
-rw-r--r--web/app/controller/Root.js28
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';
+ }
}
},