Fix `verification user not found` error during identity verification
What does this MR do and why?
- Partially resolves https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/347
- We haven't been able to find out all the causes of this error, but one scenario that can occur is when a user completes identity verification and then uses their browser's back button to navigate back to the identity verification page. In that case, the
Verification user not founderror does get logged. - To resolve that we check if the user is already logged-in/verified in the
require_verification_userand we add logging events to all methods so we can find out other triggers for this error.
Screenshots or screen recordings
| Before | After |
|---|---|
| before-verification-user-not-found | after-verification-user-not-found |
How to set up and validate locally
Setting-up Identity Verification
- In rails console, enable the feature flag and configure identity verification
> Feature.enable(:identity_verification)
> ApplicationSetting.first.update(email_confirmation_setting: "hard", require_admin_approval_after_user_signup: false)
- Sign-up as a new user on
/users/sign_up - You should see a page asking you to confirm your email address.
- Go to
/rails/letter_openerand complete the email verification & onboarding process. - Now, using the browser's back button navigate back to the identity verification page. You should see the
Verification successfulpage and you won't be able to find any logs inapplication_json.logwith error messageVerification user not found.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Hinam Mehra