How to verify user account email?

How to verify user account if they create account using email?

I’d suggest you use a 3rd party service to send your verification email using an after hook on AuthenticateEmail. If the account is newly created, the created property in Session is set to true.

To prevent the user from logging in until verification happens (or gating other features) you could use a before hook on AuthenticateEmail that uses the runtime accountsGetId function to check whether the account exists, if it does, check the account verifyTime (a value > 0 would signify the account is verified if the verification flow is set up correctly), otherwise allow AuthenticateEmail to go through to create the new account.

As for handling the verification, please see: Email Verification Status. The easiest would be to set up a separate server to receive the email verification token and then use a S2S server call to set the verify_time as described in the thread above.

Hope this helps.

2 Likes