50 lines
1.4 KiB
JavaScript
50 lines
1.4 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() {
|
|
// console.log($scope.credentials);
|
|
// console.log($scope.credentials.email);
|
|
User.resendVerifyEmail($scope.credentials.email).then(
|
|
function(response){
|
|
console.log(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){
|
|
console.log('Success: '+response.message);
|
|
$scope.success = response.message;
|
|
$scope.isResetSent = true;
|
|
$scope.credentials.email = null;
|
|
},
|
|
function(error){
|
|
console.log('Error: '+error.message);
|
|
$scope.isResetSent = false;
|
|
$scope.error = error;
|
|
$scope.credentials.email = null;
|
|
}
|
|
);
|
|
}
|
|
};
|
|
}
|
|
]); |