Hi all,
I hope you have started this year well. I’m trying to create an Action that forces the user to verify her email before being able to authenticate.
In Rules, there is an already defined template that is the following:
function emailVerified(user, context, callback) {
if (!user.email_verified) {
return callback(
new UnauthorizedError('Please verify your email before logging in.')
);
} else {
return callback(null, user, context);
}
}
What I want to do is basically migrate that same Rule to Actions, and what I was able to build is the following:
(Post User Registration Flow)
exports.onExecutePostUserRegistration = async (event) => {
if (event.user.email_verified == false) {
console.log ("Please verify your email before logging in.");
return;
}
};
This same thing is not giving me any result, any solution / advice?
Thanks a lot!
Santiago.