Files
meanTorrent/modules/users/client/controllers/settings/change-password.client.controller.js
2015-07-09 14:23:31 -04:00

21 lines
606 B
JavaScript

'use strict';
angular.module('users').controller('ChangePasswordController', ['$scope', '$http', 'Authentication',
function($scope, $http, Authentication) {
$scope.user = Authentication.user;
// Change user password
$scope.changeUserPassword = function() {
$scope.success = $scope.error = null;
$http.post('/api/users/password', $scope.passwordDetails).success(function(response) {
// If successful show success message and clear form
$scope.success = true;
$scope.passwordDetails = null;
}).error(function(response) {
$scope.error = response.message;
});
};
}
]);