Custom email confirmation logic

Hi, everyone. I wonder if we can tune email confirmation logic in Strapi.

If you set “Enable email confirmation to ON”, then the Strapi logic as follows:

  1. User registers using “/auth/local” endpoint.
  2. User can not login and get JWT before he confirms his email address.

Many services do a bit different logic.

  1. User registers and immediately logins to the website.
  2. There is a banner on top saying “Verify your email to get full access. Didn’t receive an email? Resend confirmation button”.
  3. In the email there are two buttons - “confirm email” and ” Let us know you didn’t sign up”. First one - confirms email and gives a user a full access, second - deletes account (in case someone registered with 3rd person email)

What is the best way to achieve this?

3 Likes

hey! have you solved it?

Hey! At this point it might make more sense to just roll out your custom business logic?

After a successful signup - you could navigate the user to your desired page and show him the “Needs email confirm” popup. Then in your database you save a boolean variable such as “hasConfirmedEmail” and check that value whenever the user tries to do something in your app. Meanwhile on successful signup by overriding the user plugin you also send a email to the user with an identifier and link that calls your api and updates the “hasConfirmedEmail” value.

Hope that helps!

2 Likes