Do not require password for user and group deletion
This commit is contained in:
@@ -35,46 +35,27 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
|
||||
busy: false,
|
||||
error: {},
|
||||
userInfo: {},
|
||||
password: '',
|
||||
|
||||
show: function (userInfo) {
|
||||
$scope.userremove.error.username = null;
|
||||
$scope.userremove.error.password = null;
|
||||
$scope.userremove.password = '';
|
||||
$scope.userremove.userInfo = userInfo;
|
||||
|
||||
$scope.userremove_form.$setPristine();
|
||||
$scope.userremove_form.$setUntouched();
|
||||
|
||||
$('#userRemoveModal').modal('show');
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
$scope.userremove.error.password = null;
|
||||
$scope.userremove.busy = true;
|
||||
|
||||
// transfer to self for now. not transferred to owner because this user probably wants to "manage" it immediately
|
||||
// FIXME: this may awkwardly transfer resources but fail with incorrect password
|
||||
Client.transferOwnership($scope.userremove.userInfo.id, $scope.userInfo.id, function (error) {
|
||||
if (error) return console.error('Unable to transfer resources.', error);
|
||||
|
||||
Client.removeUser($scope.userremove.userInfo.id, $scope.userremove.password, function (error) {
|
||||
Client.removeUser($scope.userremove.userInfo.id, function (error) {
|
||||
$scope.userremove.busy = false;
|
||||
|
||||
if (error && error.statusCode === 403) {
|
||||
$scope.userremove.error.password = 'Wrong password';
|
||||
$scope.userremove.password = '';
|
||||
$scope.userremove_form.password.$setPristine();
|
||||
$('#inputUserRemovePassword').focus();
|
||||
return;
|
||||
}
|
||||
if (error) return console.error('Unable to delete user.', error);
|
||||
|
||||
$scope.userremove.userInfo = {};
|
||||
$scope.userremove.password = '';
|
||||
|
||||
$scope.userremove_form.$setPristine();
|
||||
$scope.userremove_form.$setUntouched();
|
||||
|
||||
refresh();
|
||||
|
||||
@@ -367,20 +348,15 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
|
||||
busy: false,
|
||||
error: {},
|
||||
group: null,
|
||||
password: '',
|
||||
memberCount: 0,
|
||||
|
||||
show: function (group) {
|
||||
$scope.groupRemove.busy = false;
|
||||
|
||||
$scope.groupRemove.error = {};
|
||||
$scope.groupRemove.password = '';
|
||||
|
||||
$scope.groupRemove.group = angular.copy(group);
|
||||
|
||||
$scope.groupRemoveForm.$setUntouched();
|
||||
$scope.groupRemoveForm.$setPristine();
|
||||
|
||||
Client.getGroup(group.id, function (error, result) {
|
||||
if (error) return console.error('Unable to fetch group information.', error.statusCode, error.message);
|
||||
|
||||
@@ -394,16 +370,9 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
|
||||
$scope.groupRemove.busy = true;
|
||||
$scope.groupRemove.error = {};
|
||||
|
||||
Client.removeGroup($scope.groupRemove.group.id, $scope.groupRemove.password, function (error) {
|
||||
Client.removeGroup($scope.groupRemove.group.id, function (error) {
|
||||
$scope.groupRemove.busy = false;
|
||||
|
||||
if (error && error.statusCode === 403) {
|
||||
$scope.groupRemove.error.password = 'Wrong password';
|
||||
$scope.groupRemove.password = '';
|
||||
$scope.groupRemoveForm.password.$setPristine();
|
||||
$('#groupRemovePasswordInput').focus();
|
||||
return;
|
||||
}
|
||||
if (error) return console.error('Unable to remove group.', error.statusCode, error.message);
|
||||
|
||||
refresh();
|
||||
|
||||
Reference in New Issue
Block a user