Allow superusers to disable user accounts

This commit is contained in:
Joseph Schorr 2015-05-11 17:13:42 -04:00
parent 442cbed087
commit dc5af7496c
19 changed files with 291 additions and 37 deletions

View file

@ -53,6 +53,7 @@ angular.module('quay').directive('signinForm', function () {
$scope.signingIn = false;
$scope.needsEmailVerification = false;
$scope.invalidCredentials = false;
$scope.invalidCredentialsMessage = null;
if ($scope.signedIn != null) {
$scope.signedIn();
@ -77,6 +78,7 @@ angular.module('quay').directive('signinForm', function () {
if (result.status == 429 /* try again later */) {
$scope.needsEmailVerification = false;
$scope.invalidCredentials = false;
$scope.invalidCredentialsMessage = null;
$scope.cancelInterval();
@ -87,9 +89,12 @@ angular.module('quay').directive('signinForm', function () {
$scope.cancelInterval();
}
}, 1000, $scope.tryAgainSoon);
} else if (result.status == 400) {
bootbox.alert(ApiService.getErrorMessage(result));
} else {
$scope.needsEmailVerification = result.data.needsEmailVerification;
$scope.invalidCredentials = result.data.invalidCredentials;
$scope.invalidCredentialsMessage = result.data.message;
}
});
};

View file

@ -232,6 +232,32 @@
});
};
$scope.askDisableUser = function(user) {
var message = 'Are you sure you want to disable this user? ' +
'They will be unable to login, pull or push.'
if (!user.enabled) {
message = 'Are you sure you want to reenable this user? ' +
'They will be able to login, pull or push.'
}
bootbox.confirm(message, function(resp) {
if (resp) {
var params = {
'username': user.username
};
var data = {
'enabled': !user.enabled
};
ApiService.changeInstallUser(data, params).then(function(resp) {
$scope.loadUsersInternal();
});
}
});
};
$scope.changeUserPassword = function(user) {
$('#changePasswordModal').modal('hide');