Fix change password to not reload the user on every keystroke

This commit is contained in:
Joseph Schorr 2013-12-27 14:14:21 -05:00
parent 56bb46ffb2
commit 619f3abc16
2 changed files with 7 additions and 6 deletions

View file

@ -625,6 +625,7 @@ function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, Use
UserService.updateUserIn($scope, function(user) {
$scope.askForPassword = user.askForPassword;
$scope.cuser = jQuery.extend({}, user);
});
$scope.readyForPlan = function() {
@ -701,13 +702,13 @@ function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, Use
$scope.updatingUser = true;
$scope.changePasswordSuccess = false;
ApiService.changeUserDetails($scope.user).then(function() {
ApiService.changeUserDetails($scope.cuser).then(function() {
$scope.updatingUser = false;
$scope.changePasswordSuccess = true;
// Reset the form
$scope.user.password = '';
$scope.user.repeatPassword = '';
$scope.cuser.password = '';
$scope.cuser.repeatPassword = '';
$scope.changePasswordForm.$setPristine();
// Reload the user.