Skip to content

Require users to copy, download, or print 2FA recovery codes

Peter Hegman requested to merge 267730-2fa-ux-save-recovery-codes into master

What does this MR do?

Related to #267730 (closed)

To encourage users to save their 2FA recovery codes this MR adds "Copy codes", "Download codes" and "Print codes" buttons to the recovery codes view. It also disables the "Proceed" button until the the user has either copied, downloaded, or printed their codes.

Local testing

  1. Enable vue_2fa_recovery_codes feature flag
    • bin/rails console
    • Feature.enable(:vue_2fa_recovery_codes)
  2. Navigate to /-/profile/account
  3. Click "Enable two-factor authentication"
  4. Open up 1Password
  5. Click + icon and then "Login"
  6. Create a new "One-Time Password" section
    • Screen_Shot_2020-12-03_at_11.33.49_AM
  7. Click the QR icon left of the dropdown that was just used
  8. Drag the QR window over the QR code
  9. Paste the OTP in the "Pin code" field and click "Register with two-factor app"

Lock yourself out of GDK by accident?

No need to panic, I did this a bunch of times 😆

  1. bin/rails console
  2. user = User.find(1) (or whatever ID your user is, default admin is 1)
  3. TwoFactor::DestroyService.new(user, user: user).execute

Screenshots (strongly suggested)

Desktop

Page Before After
Recovery codes Screen_Shot_2020-12-03_at_11.50.21_AM Screen_Shot_2020-12-03_at_11.45.22_AM
Recovery codes - Proceed enabled N/A Screen_Shot_2020-12-03_at_11.47.49_AM
Account after clicking "Proceed" Screen_Shot_2020-12-03_at_11.51.01_AM Screen_Shot_2020-12-03_at_11.45.56_AM

Mobile

Page Before After
Recovery codes Screen_Shot_2020-12-03_at_11.50.39_AM Screen_Shot_2020-12-03_at_11.48.39_AM
Account after clicking "Proceed" Screen_Shot_2020-12-03_at_11.51.18_AM Screen_Shot_2020-12-03_at_11.46.54_AM

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Peter Hegman

Merge request reports