Add password reset feature in login view

This commit is contained in:
Johannes Zellner
2020-02-04 15:27:35 +01:00
parent 1b0c5f8771
commit a50fa9bcf4
2 changed files with 49 additions and 2 deletions
+16
View File
@@ -10,11 +10,13 @@ app.controller('LoginController', ['$scope', '$http', function ($scope, $http) {
var search = decodeURIComponent(window.location.search).slice(1).split('&').map(function (item) { return item.indexOf('=') === -1 ? [item, true] : [item.slice(0, item.indexOf('=')), item.slice(item.indexOf('=')+1)]; }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {});
$scope.initialized = false;
$scope.passwordReset = !!search.passwordReset;
$scope.busy = false;
$scope.error = null;
$scope.username = '';
$scope.password = '';
$scope.totpToken = '';
$scope.passwordResetIdentifier = '';
$scope.onLogin = function () {
$scope.busy = true;
@@ -43,4 +45,18 @@ app.controller('LoginController', ['$scope', '$http', function ($scope, $http) {
window.location.href = search.returnTo || '/';
}).error(error);
};
$scope.onPasswordReset = function () {
};
$scope.showPasswordReset = function () {
$scope.passwordReset = true;
setTimeout(function () { $('#inputPasswordResetIdentifier').focus(); }, 200);
};
$scope.showLogin = function () {
$scope.passwordReset = false;
setTimeout(function () { $('#inputUsername').focus(); }, 200);
};
}]);