Skip to content

Change email validation regex to use Devise email regex

Alex Buijs requested to merge fix-email-validation-regex into master

What does this MR do and why?

Change email validation regex to use the Devise email regex, which is used to validate email addresses on the backend.

Before this MR, email addresses with a plus sign were rejected. Now they are not anymore.

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

Screenshots or screen recordings

Before After
Screenshot_2023-08-04_at_13.04.30 Screenshot_2023-08-04_at_13.04.57

How to set up and validate locally

  1. Enable the feature flag in Rails console
    Feature.enable(:require_email_verification)
  2. Sign out
  3. Sign in 3 times with a wrong password
  4. Sign in with your correct password
  5. Click Update email
  6. Verify an email address with a plus-sign in it (eg. abuijs+test@gitlab.com) is not rejected anymore

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