Plain password reset for a user
This commit is contained in:
@@ -537,58 +537,28 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
|
||||
return user.username === Client.getUserInfo().username;
|
||||
};
|
||||
|
||||
$scope.invitation = {
|
||||
$scope.passwordReset = {
|
||||
busy: false,
|
||||
reset2FABusy: false,
|
||||
setupLink: '',
|
||||
resetLink: '',
|
||||
user: null,
|
||||
successSend: false,
|
||||
|
||||
show: function (user) {
|
||||
$scope.invitation.user = user;
|
||||
$scope.invitation.setupLink = '';
|
||||
$scope.invitation.busy = false;
|
||||
$scope.invitation.reset2FABusy = false;
|
||||
$scope.invitation.successSend = false;
|
||||
$scope.passwordReset.user = user;
|
||||
$scope.passwordReset.resetLink = '';
|
||||
$scope.passwordReset.busy = false;
|
||||
|
||||
$('#invitationModal').modal('show');
|
||||
$('#passwordResetModal').modal('show');
|
||||
},
|
||||
|
||||
generateNewLink: function () {
|
||||
$scope.invitation.busyNew = true;
|
||||
submit: function () {
|
||||
$scope.passwordReset.busy = true;
|
||||
|
||||
Client.createInvite($scope.invitation.user.id, function (error, result) {
|
||||
$scope.invitation.busyNew = false;
|
||||
if (error) return console.error(error);
|
||||
$scope.invitation.setupLink = result.inviteLink;
|
||||
});
|
||||
},
|
||||
Client.sendPasswordReset($scope.passwordReset.user.email, function (error, result) {
|
||||
$scope.passwordReset.busy = false;
|
||||
|
||||
email: function () {
|
||||
$scope.invitation.busySend = true;
|
||||
|
||||
Client.sendInvite($scope.invitation.user.id, function (error) {
|
||||
$scope.invitation.busySend = false;
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.invitation.successSend = true;
|
||||
|
||||
$timeout(function () { $scope.invitation.successSend = false; }, 3000);
|
||||
});
|
||||
},
|
||||
|
||||
reset2FA: function () {
|
||||
$scope.invitation.reset2FABusy = true;
|
||||
|
||||
Client.disableTwoFactorAuthenticationByUserId($scope.invitation.user.id, function (error) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$timeout(function () {
|
||||
$scope.invitation.reset2FABusy = false;
|
||||
$scope.invitation.user.twoFactorAuthenticationEnabled = false;
|
||||
}, 3000);
|
||||
|
||||
refreshUsers();
|
||||
$scope.passwordReset.resetLink = result.resetLink;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user