Add ability for superusers to change user emails

This commit is contained in:
Joseph Schorr 2015-05-11 14:38:10 -04:00
parent 628d80895d
commit 1c41d34b7c
4 changed files with 60 additions and 13 deletions

View file

@ -124,6 +124,11 @@
$('#changePasswordModal').modal({});
};
$scope.showChangeEmail = function(user) {
$scope.userToChange = user;
$('#changeEmailModal').modal({});
};
$scope.createUser = function() {
$scope.creatingUser = true;
$scope.createdUser = null;
@ -160,6 +165,24 @@
$('#confirmDeleteUserModal').modal({});
};
$scope.changeUserEmail = function(user) {
$('#changeEmailModal').modal('hide');
var params = {
'username': user.username
};
var data = {
'email': user.newemail
};
ApiService.changeInstallUser(data, params).then(function(resp) {
$scope.loadUsersInternal();
user.email = user.newemail;
delete user.newemail;
}, ApiService.errorDisplay('Could not change user'));
};
$scope.changeUserPassword = function(user) {
$('#changePasswordModal').modal('hide');