diff options
Diffstat (limited to 'web/app/view/dialog')
-rw-r--r-- | web/app/view/dialog/Login.js | 4 | ||||
-rw-r--r-- | web/app/view/dialog/LoginController.js | 28 |
2 files changed, 29 insertions, 3 deletions
diff --git a/web/app/view/dialog/Login.js b/web/app/view/dialog/Login.js index 3a2c247a..86917b94 100644 --- a/web/app/view/dialog/Login.js +++ b/web/app/view/dialog/Login.js @@ -102,6 +102,10 @@ Ext.define('Traccar.view.dialog.Login', { }, buttons: [{ + text: Strings.loginReset, + handler: 'onResetClick', + reference: 'resetButton' + }, { text: Strings.loginRegister, handler: 'onRegisterClick', reference: 'registerButton' diff --git a/web/app/view/dialog/LoginController.js b/web/app/view/dialog/LoginController.js index c25d9a83..47270309 100644 --- a/web/app/view/dialog/LoginController.js +++ b/web/app/view/dialog/LoginController.js @@ -1,5 +1,5 @@ /* - * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,8 +24,8 @@ Ext.define('Traccar.view.dialog.LoginController', { ], init: function () { - this.lookupReference('registerButton').setDisabled( - !Traccar.app.getServer().get('registration')); + this.lookupReference('resetButton').setHidden(!Traccar.app.getServer().get('emailEnabled')); + this.lookupReference('registerButton').setDisabled(!Traccar.app.getServer().get('registration')); this.lookupReference('languageField').setValue(Locale.language); }, @@ -113,5 +113,27 @@ Ext.define('Traccar.view.dialog.LoginController', { onRegisterClick: function () { Ext.create('Traccar.view.dialog.Register').show(); + }, + + onResetClick: function () { + Ext.Msg.prompt(Strings.loginReset, Strings.userEmail, function (btn, text) { + if (btn == 'ok') { + Ext.Ajax.request({ + scope: this, + method: 'POST', + url: 'api/password/reset', + params: { + email: text + }, + callback: function (options, success, response) { + if (success) { + Traccar.app.showToast(Strings.loginResetSuccess); + } else { + Traccar.app.showError(response.responseText); + } + } + }); + } + }); } }); |