Merge pull request #2929 from coreos-inc/joseph.schorr/QS-72/oidc-name-issue

Fix bugs in updateuser
This commit is contained in:
josephschorr 2017-12-01 22:23:56 +02:00 committed by GitHub
commit 4a5626e64b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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') @nickname('getOrganization')
def get(self, orgname): def get(self, orgname):
""" Get the details for the specified organization """ """ Get the details for the specified organization """

View file

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