aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-04-14 22:52:45 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-04-14 22:52:53 -0700
commit67230fe32f1c18517c334aa2293841c4a531b45e (patch)
tree90cb018749285de7fcd4476b5acc74fdc0915f9a /web/app/view
parentbfe5b547bc7c6dee70fc95034a175a5c9d8012af (diff)
downloadtrackermap-web-67230fe32f1c18517c334aa2293841c4a531b45e.tar.gz
trackermap-web-67230fe32f1c18517c334aa2293841c4a531b45e.tar.bz2
trackermap-web-67230fe32f1c18517c334aa2293841c4a531b45e.zip
Implement password reset
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/dialog/Login.js4
-rw-r--r--web/app/view/dialog/LoginController.js28
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);
+ }
+ }
+ });
+ }
+ });
}
});