tellform/public/modules/users/controllers/verify.client.controller.js
2017-10-02 08:17:39 -07:00

45 lines
1.2 KiB
JavaScript

'use strict';
angular.module('users').controller('VerifyController', ['$scope', '$state', '$rootScope', 'User', 'Auth', '$stateParams',
function($scope, $state, $rootScope, User, Auth, $stateParams) {
$scope.isResetSent = false;
$scope.credentials = {};
$scope.error = '';
// Submit forgotten password account id
$scope.resendVerifyEmail = function() {
User.resendVerifyEmail($scope.credentials.email).then(
function(response){
$scope.success = response.message;
$scope.credentials = null;
$scope.isResetSent = true;
},
function(error){
$scope.error = error;
$scope.credentials.email = null;
$scope.isResetSent = false;
}
);
};
//Validate Verification Token
$scope.validateVerifyToken = function() {
if($stateParams.token){
console.log($stateParams.token);
User.validateVerifyToken($stateParams.token).then(
function(response){
$scope.success = response.message;
$scope.isResetSent = true;
$scope.credentials.email = null;
},
function(error){
$scope.isResetSent = false;
$scope.error = error;
$scope.credentials.email = null;
}
);
}
};
}
]);