FIX: User can't reset password with backup codes when only security key is enabled (#27368)

This commit fixes a problem where the user will not be able to reset
their password when they only have security keys and backup codes
configured.

This commit also makes the following changes/fixes:

1. Splits password reset system tests to
   `spec/system/forgot_password_spec.rb` instead of missing the system
   tests in `spec/system/login_spec.rb` which is mainly used to test
   the login flow.

2. Fixes a UX issue where the `Use backup codes` or `Use authenticator
   app` text is shown on the reset password form when the user does
   not have either backup codes or an authenticator app configured.
This commit is contained in:
Alan Guo Xiang Tan
2024-06-06 14:30:42 +08:00
committed by GitHub
parent 4b1e017722
commit 952f69ce60
16 changed files with 363 additions and 76 deletions

View File

@ -102,7 +102,7 @@ describe "Changing email", type: :system do
expect(page).to have_current_path("/u/#{user.username}/preferences/account")
expect(user_preferences_page).to have_primary_email(new_email)
ensure
authenticator.remove!
authenticator&.remove!
end
it "does not require login to verify" do