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) {
|
UserService.updateUserIn($scope, function(user) {
|
||||||
$scope.askForPassword = user.askForPassword;
|
$scope.askForPassword = user.askForPassword;
|
||||||
|
$scope.cuser = jQuery.extend({}, user);
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.readyForPlan = function() {
|
$scope.readyForPlan = function() {
|
||||||
|
@ -701,13 +702,13 @@ function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, Use
|
||||||
$scope.updatingUser = true;
|
$scope.updatingUser = true;
|
||||||
$scope.changePasswordSuccess = false;
|
$scope.changePasswordSuccess = false;
|
||||||
|
|
||||||
ApiService.changeUserDetails($scope.user).then(function() {
|
ApiService.changeUserDetails($scope.cuser).then(function() {
|
||||||
$scope.updatingUser = false;
|
$scope.updatingUser = false;
|
||||||
$scope.changePasswordSuccess = true;
|
$scope.changePasswordSuccess = true;
|
||||||
|
|
||||||
// Reset the form
|
// Reset the form
|
||||||
$scope.user.password = '';
|
$scope.cuser.password = '';
|
||||||
$scope.user.repeatPassword = '';
|
$scope.cuser.repeatPassword = '';
|
||||||
$scope.changePasswordForm.$setPristine();
|
$scope.changePasswordForm.$setPristine();
|
||||||
|
|
||||||
// Reload the user.
|
// Reload the user.
|
||||||
|
|
|
@ -60,9 +60,9 @@
|
||||||
<div ng-show="!updatingUser">
|
<div ng-show="!updatingUser">
|
||||||
<form class="form-change-pw col-md-6" name="changePasswordForm" ng-submit="changePassword()" data-trigger="manual"
|
<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">
|
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="Your new password" ng-model="cuser.password" required>
|
||||||
<input type="password" class="form-control" placeholder="Verify your new password" ng-model="user.repeatPassword"
|
<input type="password" class="form-control" placeholder="Verify your new password" ng-model="cuser.repeatPassword"
|
||||||
match="user.password" required>
|
match="cuser.password" required>
|
||||||
<button class="btn btn-danger" ng-disabled="changePasswordForm.$invalid" type="submit"
|
<button class="btn btn-danger" ng-disabled="changePasswordForm.$invalid" type="submit"
|
||||||
analytics-on analytics-event="change_pass">Change Password</button>
|
analytics-on analytics-event="change_pass">Change Password</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
Reference in a new issue