RequestResetController.js 887 Bytes
angular.module('flashy.RequestResetController', ['ui.router']).
controller('RequestResetController', ['$scope', '$state', '$http',
function($scope, $state, $http) {
'use strict';
$scope.success = false;
$scope.error = false;
$scope.resetPass = function(email) {
$http.post('/api/request_password_reset/', JSON.stringify({
'email': email
})).
success(function(data) {
$scope.success = true;
//$state.go('requestresetsuccess');
console.log('SUCCESS');
console.log(data);
}).
error(function(data, status, header, config) {
if (data.email) {
$scope.error = true;
}
console.log('ERROR');
console.log(data);
});
};
$scope.cancelReset = function() {
$state.go('login');
};
}]);