Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/users/backup_code_setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class BackupCodeSetupController < ApplicationController

before_action :authenticate_user!
before_action :confirm_user_authenticated_for_2fa_setup
before_action :ensure_backup_codes_in_session, only: %i[continue download]
before_action :ensure_backup_codes_in_session, only: %i[continue download refreshed]
before_action :set_backup_code_setup_presenter
before_action :apply_secure_headers_override

Expand Down
12 changes: 12 additions & 0 deletions spec/controllers/users/backup_code_setup_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,16 @@
expect(response).to redirect_to(account_two_factor_authentication_path)
expect(user.backup_code_configurations.length).to eq 0
end

describe '#refreshed' do
render_views

it 'does not 500 when codes have not been generated' do
user = create(:user, :signed_up)
stub_sign_in(user)
get :refreshed

expect(response).to redirect_to(backup_code_setup_url)
end
end
end