fixed signup verification bug

This commit is contained in:
David Baldwynn 2017-07-27 23:27:24 -04:00
parent 2896677432
commit d07c1c28ce
2 changed files with 5 additions and 7 deletions

View file

@ -60,20 +60,17 @@ var config_nev = function () {
config_nev();
exports.validateVerificationToken = function(req, res){
console.log(req.user);
nev.confirmTempUser(req.params.token, function(err, user) {
//FIXME: Quick hack to prevent already verified users from seeing link has expired page
if(errorHandler.getErrorMessage(err) === "Unique field already exists") {
return res.status(200).send('User successfully verified');
}
console.log(err);
if(err) {
return res.status(500).send( {message: errorHandler.getErrorMessage(err) } );
return res.status(500).send( {message: err } );
}
else if (user){
return res.status(200).send('User successfully verified');
}
// redirect to resend verification email
return res.status(400).send( {message: 'Verification token is invalid or has expired'} );
else return res.status(400).send( {message: 'Verification token is invalid or has expired'} );
});
};

View file

@ -106,6 +106,7 @@
"coveralls": "^2.11.4",
"cross-spawn": "^5.0.0",
"del": "^2.2.2",
"email-verification": "github:tellform/node-email-verification",
"grunt-closure-compiler": "0.0.21",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-copy": "^1.0.0",