Resend verification email from Lock

Is it possible to trigger a resend verification email from the login page of Lock via a link or button?

1 Like

Unfortunately, there’s no such option in Lock.

What you can do is create a new rule using the Force email verification template, and customize it to add logic for automatically sending email verification on a login attempt from a user with an unverified email address:

function (user, context, callback) {
  if (!user.email_verified) {
   // Combine with a call to our Management API, to trigger an email verification:
   // https://auth0.com/docs/api/management/v2#!/Jobs/post_verification_email

   // To avoid multiple email verification emails to be triggered in a short amount of time,
   // use user.app_metadata to store the last time you sent the email verification,
   // and don't automatically send a new one until a few minutes later

    return callback(new UnauthorizedError('Please verify your email before logging in.'));
  } else {
    return callback(null, user, context);
  }
}