Merge pull request #2086 from coreos-inc/user-info

Add collection of user metadata: name and company
This commit is contained in:
josephschorr 2016-11-09 13:15:07 -05:00 committed by GitHub
commit 45b1148118
14 changed files with 178 additions and 33 deletions

View file

@ -21,7 +21,11 @@
UserService.updateUserIn($scope, function(user) {
if (!user.anonymous) {
$location.path('/repository/');
if (user.prompts && user.prompts.length) {
$location.path('/updateuser/');
} else {
$location.path('/repository/');
}
}
});

View file

@ -10,6 +10,7 @@
function UpdateUserCtrl($scope, UserService, $location, ApiService) {
$scope.state = 'loading';
$scope.metadata = {};
UserService.updateUserIn($scope, function(user) {
if (!user.anonymous) {
@ -45,15 +46,17 @@
});
};
$scope.updateUsername = function(username) {
$scope.state = 'updating';
var data = {
'username': username
};
ApiService.changeUserDetails(data).then(function() {
window.location = '/';
}, ApiService.errorDisplay('Could not update username'));
$scope.updateUser = function(data) {
$scope.state = 'updating';
ApiService.changeUserDetails(data).then(function() {
UserService.load(function(updated) {
if (updated.prompts.length) {
$scope.state = 'editing';
} else {
$location.url('/');
}
});
}, ApiService.errorDisplay('Could not update user information'));
};
$scope.hasPrompt = function(user, prompt_name) {