Files
meanTorrent/modules/users/client/controllers/settings/change-password.client.controller.js
2014-11-10 23:12:33 +02:00

21 lines
646 B
JavaScript

'use strict';
angular.module('users').controller('ChangePasswordController', ['$scope', '$http', '$location', 'Users', 'Authentication',
function($scope, $http, $location, Users, 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;
});
};
}
]);