Fix bugs in updateuser

1) Also check for matching organization names
2) Ensure that errors don't leave the throbber
This commit is contained in:
Joseph Schorr 2017-12-01 14:58:29 -05:00
parent c383ac1f9d
commit 4db1615d94
2 changed files with 18 additions and 7 deletions

View file

@ -149,7 +149,6 @@ class Organization(ApiResource):
},
}
@require_scope(scopes.ORG_ADMIN)
@nickname('getOrganization')
def get(self, orgname):
""" Get the details for the specified organization """

View file

@ -35,19 +35,31 @@
'username': username
};
var oparams = {
'orgname': username
};
ApiService.getUserInformation(null, params).then(function() {
$scope.state = 'existing';
}, function(resp) {
if (resp.status == 404) {
$scope.state = 'confirmed';
} else {
$scope.state = 'error';
}
ApiService.getOrganization(null, oparams).then(function() {
$scope.state = 'existing';
}, function() {
if (resp.status == 404) {
$scope.state = 'confirmed';
} else {
$scope.state = 'error';
}
});
});
};
$scope.updateUser = function(data) {
$scope.state = 'updating';
var errorHandler = ApiService.errorDisplay('Could not update user information', function() {
$scope.state = 'editing';
});
ApiService.changeUserDetails(data).then(function() {
UserService.load(function(updated) {
if (updated && updated.prompts && updated.prompts.length) {
@ -56,7 +68,7 @@
$location.url('/');
}
});
}, ApiService.errorDisplay('Could not update user information'));
}, errorHandler);
};
$scope.hasPrompt = function(user, prompt_name) {