Skip to content

Check existing credit card validations during identity verification

What does this MR do and why?

Closes: https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/686

The identity verification process allows a user to opt for validating a credit card instead of a phone number. Unfortunately, if a credit card validation was created outside of the identity verification flow (i.e. when we have the credit card requirement enabled to run pipelines) then a user will still be prompted to enter a phone number to verify their identity. This MR fixes this bug by checking to see if a user already has a credit card validation before performing other logic to determine if that user is identity verified. It is important to note that the existing credit card validation is only considered if credit_card is not a required identity verification method since, for certain users, we may require them to validate a phone and a credit card.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Start GDK with SaaS simulation
    $ export GITLAB_SIMULATE_SAAS=1
    $ gdk start
  2. Enable the opt_in_identity_verification feature flag.
    > Feature.enable(:opt_in_identity_verification)
  3. Create a user that has signed in and ensure that identity_verified? = false.
    [4] pry(main)> user = FactoryBot.create(:user, :with_sign_ins)
    [5] pry(main)> user.identity_verified?
    => false
  4. Create a credit card validation for the user and see that identity_verified? = true.
    [6] pry(main)> FactoryBot.create(:credit_card_validation, user: user)
    [7] pry(main)> user.identity_verified?
    => true
Edited by Ian Anderson

Merge request reports

Loading