From 6ac297bac5f358eda2b9bd19a51544ba4e6455ca Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 11 Aug 2021 12:16:45 -0700 Subject: [PATCH] password reset: show 2fa input --- src/js/login.js | 13 +++++++------ src/login.html | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/js/login.js b/src/js/login.js index 67eb0d896..6d2fdd3a4 100644 --- a/src/js/login.js +++ b/src/js/login.js @@ -130,32 +130,33 @@ app.controller('LoginController', ['$scope', '$translate', '$http', function ($s var data = { resetToken: search.resetToken, - password: $scope.newPassword + password: $scope.newPassword, + totpToken: $scope.totpToken }; - function error(status) { + function error(data, status) { console.log('error', status); $scope.busy = false; - if (status === 401) $scope.error = 'Invalid reset token'; + if (status === 401) $scope.error = data.message; else if (status === 409) $scope.error = 'Ask your admin for an invite link first'; else $scope.error = 'Unknown error'; } $http.post(API_ORIGIN + '/api/v1/cloudron/password_reset', data).success(function (data, status) { - if (status !== 202) return error(status); + if (status !== 202) return error(data, status); // set token to autologin localStorage.token = data.accessToken; $scope.mode = 'newPasswordDone'; }).error(function (data, status) { - error(status); + error(data, status); }); }; $scope.showPasswordReset = function () { - window.document.title = 'Password Reset'; + window.document.title = 'Password Reset Request'; $scope.mode = 'passwordReset'; $scope.passwordResetIdentifier = ''; setTimeout(function () { $('#inputPasswordResetIdentifier').focus(); }, 200); diff --git a/src/login.html b/src/login.html index a82ce2ebc..8eb9a8960 100644 --- a/src/login.html +++ b/src/login.html @@ -166,6 +166,10 @@ +
+ + +