cobuild-angular-stack
Version:
Base stack angular sass jade gulp
32 lines (29 loc) • 1.16 kB
JavaScript
(function () {
'use strict';
angular.module('uniko.authSatellizer')
.controller('ForgotCtrl', ForgotCtrl);
ForgotCtrl.$inject = ['$scope', 'CoupleAccount', 'toastr', '$localStorage', '$translate'];
function ForgotCtrl($scope, CoupleAccount, toastr, $localStorage, $translate) {
$scope.recover = function () {
var user = $scope.user;
return CoupleAccount.resetPassword({email: user.email})
.$promise
.then(function () {
$translate('account-associated').then(function(translation){
toastr.success(translation);
});
toastr.success('');
})
.catch(function (response) {
if (response.status === 404) {
$translate('account-associated').then(function(translation){
toastr.success(translation);
});
}
})
.finally(function () {
$scope.user = {};
});
};
}
})();