Fix change password to not reload the user on every keystroke
This commit is contained in:
parent
56bb46ffb2
commit
619f3abc16
2 changed files with 7 additions and 6 deletions
|
@ -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.
|
||||
|
|
|
@ -60,9 +60,9 @@
|
|||
<div ng-show="!updatingUser">
|
||||
<form class="form-change-pw col-md-6" name="changePasswordForm" ng-submit="changePassword()" data-trigger="manual"
|
||||
data-content="{{ changePasswordError }}" data-placement="right" ng-show="!awaitingConfirmation && !registering">
|
||||
<input type="password" class="form-control" placeholder="Your new password" ng-model="user.password" required>
|
||||
<input type="password" class="form-control" placeholder="Verify your new password" ng-model="user.repeatPassword"
|
||||
match="user.password" required>
|
||||
<input type="password" class="form-control" placeholder="Your new password" ng-model="cuser.password" required>
|
||||
<input type="password" class="form-control" placeholder="Verify your new password" ng-model="cuser.repeatPassword"
|
||||
match="cuser.password" required>
|
||||
<button class="btn btn-danger" ng-disabled="changePasswordForm.$invalid" type="submit"
|
||||
analytics-on analytics-event="change_pass">Change Password</button>
|
||||
</form>
|
||||
|
|
Reference in a new issue