ohmyform/public/modules/users/controllers/change_password.client.controller.js
wodka f7b1dd05e9 fix analytics
upgrade missing dependencies
upgrade libraries
change service naming
2019-07-15 10:15:06 +02:00

28 lines
790 B
JavaScript

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