Add ability to view and change an account’s email address

This commit is contained in:
Joseph Schorr 2014-01-17 17:04:05 -05:00
parent d5bbea9fb2
commit a363ada41c
8 changed files with 123 additions and 13 deletions

View file

@ -906,12 +906,13 @@ function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, Use
$scope.loading = true;
$scope.updatingUser = false;
$scope.changePasswordSuccess = false;
$scope.changeEmailSent = false;
$scope.convertStep = 0;
$scope.org = {};
$scope.githubRedirectUri = KeyService.githubRedirectUri;
$scope.githubClientId = KeyService.githubClientId;
$('.form-change-pw').popover();
$('.form-change').popover();
$scope.logsShown = 0;
$scope.invoicesShown = 0;
@ -970,8 +971,31 @@ function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, Use
});
};
$scope.changeEmail = function() {
$('#changeEmailForm').popover('hide');
$scope.updatingUser = true;
$scope.changeEmailSent = false;
ApiService.changeUserDetails($scope.cuser).then(function() {
$scope.updatingUser = false;
$scope.changeEmailSent = true;
$scope.sentEmail = $scope.cuser.email;
// Reset the form.
$scope.cuser.repeatEmail = '';
$scope.changeEmailForm.$setPristine();
}, function(result) {
$scope.updatingUser = false;
$scope.changeEmailError = result.data.message;
$timeout(function() {
$('#changeEmailForm').popover('show');
});
});
};
$scope.changePassword = function() {
$('.form-change-pw').popover('hide');
$('#changePasswordForm').popover('hide');
$scope.updatingUser = true;
$scope.changePasswordSuccess = false;
@ -991,7 +1015,7 @@ function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, Use
$scope.changePasswordError = result.data.message;
$timeout(function() {
$('.form-change-pw').popover('show');
$('#changePasswordForm').popover('show');
});
});
};