password reset: show 2fa input
This commit is contained in:
@@ -130,32 +130,33 @@ app.controller('LoginController', ['$scope', '$translate', '$http', function ($s
|
|||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
resetToken: search.resetToken,
|
resetToken: search.resetToken,
|
||||||
password: $scope.newPassword
|
password: $scope.newPassword,
|
||||||
|
totpToken: $scope.totpToken
|
||||||
};
|
};
|
||||||
|
|
||||||
function error(status) {
|
function error(data, status) {
|
||||||
console.log('error', status);
|
console.log('error', status);
|
||||||
$scope.busy = false;
|
$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 if (status === 409) $scope.error = 'Ask your admin for an invite link first';
|
||||||
else $scope.error = 'Unknown error';
|
else $scope.error = 'Unknown error';
|
||||||
}
|
}
|
||||||
|
|
||||||
$http.post(API_ORIGIN + '/api/v1/cloudron/password_reset', data).success(function (data, status) {
|
$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
|
// set token to autologin
|
||||||
localStorage.token = data.accessToken;
|
localStorage.token = data.accessToken;
|
||||||
|
|
||||||
$scope.mode = 'newPasswordDone';
|
$scope.mode = 'newPasswordDone';
|
||||||
}).error(function (data, status) {
|
}).error(function (data, status) {
|
||||||
error(status);
|
error(data, status);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.showPasswordReset = function () {
|
$scope.showPasswordReset = function () {
|
||||||
window.document.title = 'Password Reset';
|
window.document.title = 'Password Reset Request';
|
||||||
$scope.mode = 'passwordReset';
|
$scope.mode = 'passwordReset';
|
||||||
$scope.passwordResetIdentifier = '';
|
$scope.passwordResetIdentifier = '';
|
||||||
setTimeout(function () { $('#inputPasswordResetIdentifier').focus(); }, 200);
|
setTimeout(function () { $('#inputPasswordResetIdentifier').focus(); }, 200);
|
||||||
|
|||||||
@@ -166,6 +166,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<input type="password" class="form-control" id="inputNewPasswordRepeat" ng-model="newPasswordRepeat" name="newPasswordRepeat" required>
|
<input type="password" class="form-control" id="inputNewPasswordRepeat" ng-model="newPasswordRepeat" name="newPasswordRepeat" required>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="inputPasswordResetTotpToken">{{ 'login.2faToken' | tr }}</label>
|
||||||
|
<input type="text" class="form-control" name="passwordResetTotpToken" id="inputPasswordResetTotpToken" ng-model="totpToken" ng-disabled="busy" value="">
|
||||||
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<button class="btn btn-primary btn-outline pull-right" type="submit" ng-disabled="busy || newPasswordForm.$invalid || newPassword !== newPasswordRepeat"><i class="fa fa-circle-notch fa-spin" ng-show="busy"></i> {{ 'passwordReset.passwordChanged.submitAction' | tr }}</button>
|
<button class="btn btn-primary btn-outline pull-right" type="submit" ng-disabled="busy || newPasswordForm.$invalid || newPassword !== newPasswordRepeat"><i class="fa fa-circle-notch fa-spin" ng-show="busy"></i> {{ 'passwordReset.passwordChanged.submitAction' | tr }}</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Reference in New Issue
Block a user