aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/dialog/LoginController.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/dialog/LoginController.js')
-rw-r--r--web/app/view/dialog/LoginController.js28
1 files changed, 25 insertions, 3 deletions
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);
+ }
+ }
+ });
+ }
+ });
}
});