I enabled the default “Force email verification” rule. It looks like this.
function (user, context, callback) {
if (!user.email_verified) {
return callback(new UnauthorizedError('Please verify your email before logging in.'), user);
} else {
return callback(null, user, context);
}
}
After the user registers or tries to sign in before they’ve verified their email, they’ll be denied access.
I’m using the angular SPA app and I have a angularAuth0 service that receives this error. The code looks like this
angularAuth0.parseHash(function(err, authResult) {
if (err) {
if( err.errorDescription === 'Please verify your email before logging in.' ) {
// do something
}
}
});
Currently, I redirect them to a page explaining they need to verify their email. On that page, I want to allow them to initiate resending the verification email.
I’ve written and tested the code to send the verification email. The only thing is, I need the user_id of the person who tried to sign in.
How do I get that?