Reset the form back to a pristine state on a successful password change.

This commit is contained in:
yackob03 2013-10-10 14:02:28 -04:00
parent 3cadc5bdb8
commit 5b25d8db5b
2 changed files with 6 additions and 1 deletions

View file

@ -563,6 +563,11 @@ function UserAdminCtrl($scope, $timeout, Restangular, PlanService, UserService,
$scope.updatingUser = false;
$scope.changePasswordSuccess = true;
// Reset the form
$scope.user.password = '';
$scope.user.repeatPassword = '';
$scope.changePasswordForm.$setPristine();
UserService.load();
}, function(result) {
$scope.updatingUser = false;

View file

@ -69,7 +69,7 @@
<div class="panel-body">
<form class="form-change-pw" 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.repeatePassword" match="user.password" required>
<input type="password" class="form-control" placeholder="Verify your new password" ng-model="user.repeatPassword" match="user.password" required>
<button class="btn btn-danger" ng-disabled="changePasswordForm.$invalid" type="submit" analytics-on analytics-event="register">Change Password</button>
<span class="help-block" ng-show="changePasswordSuccess">Password changed successfully</span>
</form>