Skip to content

Custom email confirmation by code verification

Alex Buijs requested to merge email-code-verification into master

What does this MR do and why?

Replace Devise’s confirmation email and confirmation mechanism with our own custom implementation by verifying a 6-digit code.

This is the first phase of the barriers to entry epic and shown to users with a low risk profile.

Issue: https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/55

Screenshots or screen recordings

Click to expand
State Screen
Email sent after signing up. Screen_Shot_2022-09-13_at_23.45.45
Blank form shown directly after signing up. Screen_Shot_2022-09-02_at_14.45.24
When trying to submit without entering a code or after submitting and clearing the field. Screen_Shot_2022-09-02_at_14.45.41
When trying to submit an invalid code or after submitting and entering an invalid code. Screen_Shot_2022-09-02_at_14.45.49
When submitting an incorrect code Screen_Shot_2022-09-02_at_14.45.58
When having submitted more than 10 incorrect codes within 10 minutes Screen_Shot_2022-09-02_at_14.46.47
When submitting an expired code Screen_Shot_2022-09-02_at_14.52.17
When clicking the Resend code link Screen_Shot_2022-09-02_at_14.46.18
When an error occurs Screen_Shot_2022-09-02_at_14.54.26
When successfully verifying the code Screen_Shot_2022-09-02_at_14.56.03
After being redirected to the welcome page 3 seconds after having been on the successful verification page Screen_Shot_2022-09-02_at_14.56.32

How to set up and validate locally

  1. In rails console enable the feature flag and disable the require_admin_approval_after_user_signup and enable the send_user_confirmation_email application settings:
    Feature.enable(:identity_verification)
    ApplicationSetting.first.update(require_admin_approval_after_user_signup: false)
    ApplicationSetting.first.update(send_user_confirmation_email: true)
  2. Visit http://localhost:3000, logout and create a new user
  3. Visit http://localhost:3000/rails/letter_opener and copy the code from the email
  4. Fill in the code on the code verification page

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Alex Buijs

Merge request reports