diff options
Diffstat (limited to 'app/users/controllers/user-accounts-controller.js')
-rw-r--r-- | app/users/controllers/user-accounts-controller.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/app/users/controllers/user-accounts-controller.js b/app/users/controllers/user-accounts-controller.js index 8847f35..355ca37 100644 --- a/app/users/controllers/user-accounts-controller.js +++ b/app/users/controllers/user-accounts-controller.js @@ -32,13 +32,17 @@ window.angular && (function (angular) { // TODO: Display error return false; } - // TODO: Verify the oldPassword is correct - APIUtils.changePassword($scope.dataService.getUser(), newPassword).then(function(response){ - // Clear the textboxes on a success - $scope.passwordVerify = ''; - $scope.password = ''; - $scope.oldPassword = ''; + // Verify the oldPassword is correct + APIUtils.testPassword($scope.dataService.getUser(), oldPassword).then(function(state){ + APIUtils.changePassword($scope.dataService.getUser(), newPassword).then(function(response){ + // Clear the textboxes on a success + $scope.passwordVerify = ''; + $scope.password = ''; + $scope.oldPassword = ''; + }, function(error){ + // TODO: Display error + }); }, function(error){ // TODO: Display error }); |