Skip to content

Commit

Permalink
Remove 'create' action from BackupCodeSetupController (#10088)
Browse files Browse the repository at this point in the history
changelog: User-Facing Improvements, MFA, Remove backup code pre-warning from setup flow
  • Loading branch information
kevinsmaster5 authored May 1, 2024
1 parent a5c23dc commit add15b5
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 157 deletions.
18 changes: 0 additions & 18 deletions app/controllers/users/backup_code_setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@ def index
track_backup_codes_created
end

def create
generate_codes
result = BackupCodeSetupForm.new(current_user).submit
visit_result = result.to_h.merge(analytics_properties_for_visit)
analytics.backup_code_setup_visit(**visit_result)
irs_attempts_api_tracker.mfa_enroll_backup_code(success: result.success?)

save_backup_codes
track_backup_codes_created
end

def edit
analytics.backup_code_regenerate_visit(**analytics_properties_for_visit)
end
Expand Down Expand Up @@ -103,13 +92,6 @@ def mfa_user
@mfa_user ||= MfaContext.new(current_user)
end

def track_backup_codes_confirmation_setup_visit
analytics.multi_factor_auth_enter_backup_code_confirmation_visit(
enabled_mfa_methods_count: mfa_user.enabled_mfa_methods_count,
in_account_creation_flow: in_account_creation_flow?,
)
end

def ensure_backup_codes_in_session
redirect_to backup_code_setup_url unless user_session[:backup_codes]
end
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/navigation_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def backup_codes_path
if TwoFactorAuthentication::BackupCodePolicy.new(user).configured?
backup_code_regenerate_path
else
backup_code_create_path
backup_code_setup_path
end
end
end
18 changes: 0 additions & 18 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3820,24 +3820,6 @@ def multi_factor_auth_backup_code_download
track_event('Multi-Factor Authentication: download backup code')
end

# Tracks when the user visits the backup code confirmation setup page
# @param [Integer] enabled_mfa_methods_count number of registered mfa methods for the user
# @param [Boolean] in_account_creation_flow whether user is going through creation flow
def multi_factor_auth_enter_backup_code_confirmation_visit(
enabled_mfa_methods_count:,
in_account_creation_flow:,
**extra
)
track_event(
'Multi-Factor Authentication: enter backup code confirmation visited',
{
enabled_mfa_methods_count:,
in_account_creation_flow:,
**extra,
}.compact,
)
end

# @param ["authentication","reauthentication","confirmation"] context user session context
# User visited the page to enter a backup code as their MFA
def multi_factor_auth_enter_backup_code_visit(context:, **extra)
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/actions/_generate_backup_codes.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= render ButtonComponent.new(
url: backup_code_create_path,
url: backup_code_setup_path,
icon: :add,
class: 'usa-button usa-button--outline margin-top-2',
).with_content(t('forms.backup_code.generate')) %>
59 changes: 0 additions & 59 deletions app/views/users/backup_code_setup/create.html.erb

This file was deleted.

1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@
get '/backup_code_refreshed' => 'users/backup_code_setup#refreshed'
get '/backup_code_reminder' => 'users/backup_code_setup#reminder'
get '/backup_code_setup' => 'users/backup_code_setup#index'
patch '/backup_code_setup' => 'users/backup_code_setup#create', as: :backup_code_create
patch '/backup_code_continue' => 'users/backup_code_setup#continue'
get '/backup_code_regenerate' => 'users/backup_code_setup#edit'
get '/backup_code_delete' => 'users/backup_code_setup#confirm_delete'
Expand Down
59 changes: 0 additions & 59 deletions spec/views/users/backup_code_setup/create.html.erb_spec.rb

This file was deleted.

0 comments on commit add15b5

Please sign in to comment.