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
11 changes: 1 addition & 10 deletions app/controllers/users/backup_code_setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,7 @@ def confirm_backup_codes; end
private

def validate_multi_mfa_selection
if IdentityConfig.store.backup_code_confirm_setup_screen_enabled
redirect_to backup_code_confirm_setup_url unless in_multi_mfa_selection_flow?
else
redirect_to root_url unless internal_referrer?
end
end

def internal_referrer?
UserSessionContext.reauthentication_context?(context) ||
session[:account_redirect_path] || in_multi_mfa_selection_flow?
redirect_to backup_code_confirm_setup_url unless in_multi_mfa_selection_flow?
end

def analytics_properties_for_visit
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/backup_code_setup/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<%= render ButtonComponent.new(
url: backup_code_setup_path,
method: IdentityConfig.store.backup_code_confirm_setup_screen_enabled ? :post : :get,
method: :post,
big: true,
wide: true,
class: 'margin-top-3 margin-bottom-2',
Expand Down
2 changes: 0 additions & 2 deletions config/application.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ aws_kms_multi_region_key_id: alias/login-dot-gov-keymaker-multi-region
aws_kms_session_key_id: alias/login-dot-gov-test-keymaker
aws_logo_bucket: ''
aws_region: 'us-west-2'
backup_code_confirm_setup_screen_enabled: true
backup_code_cost: '2000$8$1$'
broken_personal_key_window_start: '2021-07-29T00:00:00Z'
broken_personal_key_window_finish: '2021-09-22T00:00:00Z'
Expand Down Expand Up @@ -455,7 +454,6 @@ production:
attribute_encryption_key_queue: '[]'
available_locales: 'en,es,fr'
aws_logo_bucket: ''
backup_code_confirm_setup_screen_enabled: false
dashboard_api_token: ''
dashboard_url: https://dashboard.demo.login.gov
database_host: ''
Expand Down
1 change: 0 additions & 1 deletion lib/identity_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def self.store
config.add(:aws_kms_session_key_id, type: :string)
config.add(:aws_logo_bucket, type: :string)
config.add(:aws_region, type: :string)
config.add(:backup_code_confirm_setup_screen_enabled, type: :boolean)
config.add(:backup_code_cost, type: :string)
config.add(:broken_personal_key_window_finish, type: :timestamp)
config.add(:broken_personal_key_window_start, type: :timestamp)
Expand Down
27 changes: 0 additions & 27 deletions spec/controllers/users/backup_code_setup_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,33 +70,6 @@

it_behaves_like 'valid backup codes creation'
end

context 'backup code confirm setup feature disabled' do
before do
allow(IdentityConfig.store).to receive(:backup_code_confirm_setup_screen_enabled).
and_return(false)
end

it 'redirects to root url' do
expect(response).to redirect_to(root_url)
end

context 'in multi mfa setup flow' do
before do
allow(controller).to receive(:in_multi_mfa_selection_flow?).and_return(true)
end

it_behaves_like 'valid backup codes creation'
end

context 'adding backup codes from account dashboard' do
before do
controller.user_session[:account_redirect_path] = account_path
end

it_behaves_like 'valid backup codes creation'
end
end
end

describe '#create' do
Expand Down
51 changes: 0 additions & 51 deletions spec/features/account/backup_codes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,6 @@
expect(page).to have_content(t('notices.backup_codes_deleted'))
expect(page).to have_current_path(account_two_factor_authentication_path)
end

context 'backup code confirm setup feature disabled' do
before do
allow(IdentityConfig.store).to receive(:backup_code_confirm_setup_screen_enabled).
and_return(false)
end

it 'allows user to regenerate backup codes' do
expect(page).to have_content(t('account.index.backup_codes_exist'))
old_backup_code = user.backup_code_configurations.sample
click_link t('forms.backup_code.regenerate'), href: backup_code_regenerate_path
click_on t('account.index.backup_code_confirm_regenerate')

expect(page).to have_current_path(backup_code_setup_path)
expect(page).to have_content(t('forms.backup_code.title'))
expect(BackupCodeConfiguration.where(id: old_backup_code.id).any?).to eq(false)

click_continue

expect(page).to have_content(t('notices.backup_codes_configured'))
expect(page).to have_current_path(account_two_factor_authentication_path)
end
end
end

context 'without backup codes and having another mfa method' do
Expand Down Expand Up @@ -105,34 +82,6 @@
expect(page).to have_current_path(account_two_factor_authentication_path)
expect(page).to have_content(expected_message)
end

context 'backup code confirm setup feature disabled' do
before do
allow(IdentityConfig.store).to receive(:backup_code_confirm_setup_screen_enabled).
and_return(false)
end

it 'allows user to create backup codes' do
click_on t('forms.backup_code.generate')

expect(page).to have_current_path(backup_code_setup_path)

generated_at = user.backup_code_configurations.
order(created_at: :asc).first.created_at.
in_time_zone('UTC')
formatted_generated_at = l(generated_at, format: t('time.formats.event_timestamp'))

expected_message = "#{t('account.index.backup_codes_exist')} #{formatted_generated_at}"

expect(page).to have_current_path(backup_code_setup_path)
expect(page).to have_content(t('forms.backup_code.title'))
click_continue

expect(page).to have_content(t('notices.backup_codes_configured'))
expect(page).to have_current_path(account_two_factor_authentication_path)
expect(page).to have_content(expected_message)
end
end
end

context 'with only backup codes' do
Expand Down
14 changes: 0 additions & 14 deletions spec/views/users/backup_code_setup/edit.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,4 @@
it 'has a link to cancel and return to account page' do
expect(rendered).to have_link(t('links.cancel'), href: account_path)
end

context 'backup code confirm setup feature disabled' do
before do
allow(IdentityConfig.store).to receive(:backup_code_confirm_setup_screen_enabled).
and_return(false)
end

it 'has a link to confirm and proceed to setup' do
expect(rendered).to have_link(
t('account.index.backup_code_confirm_regenerate'),
href: backup_code_setup_path,
)
end
end
end