Skip to content
Closed
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
1 change: 0 additions & 1 deletion app/assets/stylesheets/components/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
@forward 'hr';
@forward 'icon';
@forward 'language-picker';
@forward 'list';
@forward 'modal';
@forward 'nav';
@forward 'page-heading';
Expand Down
17 changes: 0 additions & 17 deletions app/assets/stylesheets/components/_list.scss

This file was deleted.

5 changes: 3 additions & 2 deletions app/components/icon_list_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ def css_class
end

class IconListItemComponent < BaseComponent
attr_reader :icon, :color
attr_reader :icon, :color, :tag_options

def initialize(icon:, color:)
def initialize(icon:, color:, **tag_options)
@icon = icon
@color = color
@tag_options = tag_options
end

def icon_css_class
Expand Down
4 changes: 2 additions & 2 deletions app/components/icon_list_item_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<li class="usa-icon-list__item">
<%= content_tag(:li, **tag_options, class: [*tag_options[:class], 'usa-icon-list__item']) do %>
<%= content_tag(:div, class: icon_css_class) do %>
<%= render IconComponent.new(icon: icon) %>
<% end %>
<div class="usa-icon-list__content"><%= content %></div>
</li>
<% end %>
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def fix_broken_personal_key_url
if pii_unlocked
cacher = Pii::Cacher.new(current_user, user_session)
profile = current_user.active_profile
user_session[:personal_key] = profile.encrypt_recovery_pii(cacher.fetch)
user_session[:personal_key] = profile.encrypt_recovery_pii(cacher.fetch(profile.id))
profile.save!

analytics.broken_personal_key_regenerated
Expand Down
16 changes: 9 additions & 7 deletions app/controllers/concerns/idv/verify_info_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ def process_async_state(current_async_state)

log_idv_verification_submitted_event(
success: false,
failure_reason: { idv_verification: [:timeout] },
)
end
end
Expand All @@ -192,14 +191,18 @@ def async_state_done(current_async_state)
extra: {
address_edited: !!idv_session.address_edited,
address_line2_present: !pii[:address2].blank?,
pii_like_keypaths: [[:errors, :ssn], [:response_body, :first_name],
[:same_address_as_id],
[:state_id, :state_id_jurisdiction]],
pii_like_keypaths: [
[:errors, :ssn],
[:proofing_results, :context, :stages, :resolution, :errors, :ssn],
[:proofing_results, :context, :stages, :residential_address, :errors, :ssn],
[:proofing_results, :context, :stages, :threatmetrix, :response_body, :first_name],
[:same_address_as_id],
[:proofing_results, :context, :stages, :state_id, :state_id_jurisdiction],
],
},
)
log_idv_verification_submitted_event(
success: form_response.success?,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(form_response),
)

form_response.extra[:ssn_is_unique] = DuplicateSsnFinder.new(
Expand Down Expand Up @@ -292,7 +295,7 @@ def idv_result_to_form_response(
)
end

def log_idv_verification_submitted_event(success: false, failure_reason: nil)
def log_idv_verification_submitted_event(success: false)
pii_from_doc = pii || {}
irs_attempts_api_tracker.idv_verification_submitted(
success: success,
Expand All @@ -305,7 +308,6 @@ def log_idv_verification_submitted_event(success: false, failure_reason: nil)
date_of_birth: pii_from_doc[:dob],
address: pii_from_doc[:address1],
ssn: idv_session.ssn,
failure_reason: failure_reason,
)
end

Expand Down
5 changes: 4 additions & 1 deletion app/controllers/concerns/idv_step_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ def confirm_address_step_complete

def extra_analytics_properties
extra = {
pii_like_keypaths: [[:same_address_as_id], [:state_id, :state_id_jurisdiction]],
pii_like_keypaths: [
[:same_address_as_id],
[:proofing_results, :context, :stages, :state_id, :state_id_jurisdiction],
],
}

unless flow_session.dig(:pii_from_user, :same_address_as_id).nil?
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/concerns/unconfirmed_user_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def track_user_already_confirmed_event
irs_attempts_api_tracker.user_registration_email_confirmation(
email: @email_address.email,
success: false,
failure_reason: { email: [:already_confirmed] },
)
end

Expand All @@ -39,7 +38,6 @@ def stop_if_invalid_token
irs_attempts_api_tracker.user_registration_email_confirmation(
email: @email_address&.email,
success: false,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(result),
)
process_unsuccessful_confirmation
end
Expand Down
1 change: 0 additions & 1 deletion app/controllers/idv/by_mail/enter_code_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def create
analytics.idv_verify_by_mail_enter_code_submitted(**result.to_h)
irs_attempts_api_tracker.idv_gpo_verification_submitted(
success: result.success?,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(result),
)

if !result.success?
Expand Down
5 changes: 1 addition & 4 deletions app/controllers/idv/hybrid_handoff_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,15 @@ def handle_phone_submission
telephony_result = send_link
telephony_form_response = build_telephony_form_response(telephony_result)

failure_reason = nil
if !telephony_result.success?
failure_reason = { telephony: [telephony_result.error.class.name.demodulize] }
failure(telephony_form_response.errors[:message])
end
irs_attempts_api_tracker.idv_phone_upload_link_sent(
success: telephony_result.success?,
phone_number: formatted_destination_phone,
failure_reason: failure_reason,
)

if !failure_reason
if telephony_result.success?
redirect_to idv_link_sent_url
else
redirect_to idv_hybrid_handoff_url
Expand Down
5 changes: 0 additions & 5 deletions app/controllers/idv/otp_verification_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,9 @@ def update
result = phone_confirmation_otp_verification_form.submit(code: params[:code])
analytics.idv_phone_confirmation_otp_submitted(**result.to_h)

parsed_failure_reason =
(result.extra.slice(:code_expired) if result.extra[:code_expired]) ||
(result.extra.slice(:code_matches) if !result.success? && !result.extra[:code_matches]) ||
{}
irs_attempts_api_tracker.idv_phone_otp_submitted(
success: result.success?,
phone_number: idv_session.user_phone_confirmation_session.phone,
failure_reason: parsed_failure_reason,
)

if result.success?
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/idv/phone_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def create
irs_attempts_api_tracker.idv_phone_submitted(
success: result.success?,
phone_number: step_params[:phone],
failure_reason: irs_attempts_api_tracker.parse_failure_reason(result),
)
if result.success?
submit_proofing_attempt
Expand Down Expand Up @@ -96,7 +95,6 @@ def send_phone_confirmation_otp_and_handle_result
phone_number: @idv_phone,
success: result.success?,
otp_delivery_method: idv_session.previous_phone_step_params[:otp_delivery_preference],
failure_reason: result.success? ? {} : otp_sent_tracker_error(result),
)
if result.success?
redirect_to idv_otp_verification_url
Expand Down
1 change: 0 additions & 1 deletion app/controllers/sign_up/email_confirmations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def process_successful_confirmation
irs_attempts_api_tracker.user_registration_email_confirmation(
email: @email_address&.email,
success: true,
failure_reason: nil,
)
redirect_to sign_up_enter_password_url(confirmation_token: @confirmation_token)
end
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/sign_up/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,9 @@ def render_page
end

def track_analytics(result)
failure_reason = irs_attempts_api_tracker.parse_failure_reason(result)

analytics.password_creation(**result.to_h)
irs_attempts_api_tracker.user_registration_password_submitted(
success: result.success?,
failure_reason: failure_reason,
)
end

Expand Down
1 change: 0 additions & 1 deletion app/controllers/sign_up/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def create
irs_attempts_api_tracker.user_registration_email_submitted(
email: permitted_params[:email],
success: result.success?,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(result),
)

if result.success?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def handle_result(result)
if result.success?
_event, disavowal_token = create_user_event_with_disavowal(:personal_key_used)
alert_user_about_personal_key_sign_in(disavowal_token)
generate_new_personal_key_for_verified_users_otherwise_retire_the_key_and_ensure_two_mfa
remove_personal_key
handle_valid_otp
else
handle_invalid_otp(context: context, type: 'personal_key')
Expand All @@ -57,45 +57,17 @@ def alert_user_about_personal_key_sign_in(disavowal_token)
analytics.personal_key_alert_about_sign_in(**response.to_h)
end

def generate_new_personal_key_for_verified_users_otherwise_retire_the_key_and_ensure_two_mfa
if password_reset_profile.present?
re_encrypt_profile_recovery_pii
elsif current_user.identity_verified?
user_session[:personal_key] = PersonalKeyGenerator.new(current_user).create
else
remove_personal_key
end
end

def remove_personal_key
# for now we will regenerate a key and not show it to them so retire personal key page shows
current_user.personal_key = PersonalKeyGenerator.new(current_user).create
current_user.save!
user_session.delete(:personal_key)
end

def re_encrypt_profile_recovery_pii
analytics.personal_key_reactivation_sign_in
Pii::ReEncryptor.new(pii: pii, profile: password_reset_profile).perform
user_session[:personal_key] = password_reset_profile.personal_key
end

def password_reset_profile
@password_reset_profile ||= current_user.password_reset_profile
end

def pii
@pii ||= password_reset_profile.recover_pii(normalized_personal_key)
end

def personal_key_param
params[:personal_key_form][:personal_key]
end

def normalized_personal_key
@personal_key_form.personal_key
end

def handle_valid_otp
handle_valid_verification_for_authentication_context(
auth_method: TwoFactorAuthenticatable::AuthMethod::PERSONAL_KEY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def process_token
irs_attempts_api_tracker.mfa_login_piv_cac(
success: result.success?,
subject_dn: piv_cac_verification_form.x509_dn,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(result),
)
if result.success?
handle_valid_piv_cac
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def handle_webauthn_result(result)
if result.success?
handle_valid_webauthn
else
handle_invalid_webauthn
handle_invalid_webauthn(result)
end
end

Expand All @@ -54,24 +54,12 @@ def handle_valid_webauthn
redirect_to after_sign_in_path_for(current_user)
end

def handle_invalid_webauthn
def handle_invalid_webauthn(result)
flash[:error] = result.first_error_message

if platform_authenticator?
flash[:error] = t(
'two_factor_authentication.webauthn_error.try_again',
link: view_context.link_to(
t('two_factor_authentication.webauthn_error.additional_methods_link'),
login_two_factor_options_path,
),
)
redirect_to login_two_factor_webauthn_url(platform: 'true')
else
flash[:error] = t(
'two_factor_authentication.webauthn_error.connect_html',
link_html: view_context.link_to(
t('two_factor_authentication.webauthn_error.additional_methods_link'),
login_two_factor_options_path,
),
)
redirect_to login_two_factor_webauthn_url
end
end
Expand Down Expand Up @@ -124,6 +112,8 @@ def analytics_properties
def form
@form ||= WebauthnVerificationForm.new(
user: current_user,
platform_authenticator: platform_authenticator?,
url_options:,
challenge: user_session[:webauthn_challenge],
protocol: request.protocol,
authenticator_data: params[:authenticator_data],
Expand Down
1 change: 0 additions & 1 deletion app/controllers/users/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def update
analytics.password_changed(**result.to_h)
irs_attempts_api_tracker.logged_in_password_change(
success: result.success?,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(result),
)

if result.success?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def process_piv_cac_setup
irs_attempts_api_tracker.mfa_enroll_piv_cac(
success: result.success?,
subject_dn: user_piv_cac_form.x509_dn,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(result),
)
if result.success?
process_valid_submission
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def process_piv_cac_setup
irs_attempts_api_tracker.mfa_enroll_piv_cac(
success: result.success?,
subject_dn: user_piv_cac_form.x509_dn,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(result),
)
if result.success?
process_valid_submission
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/users/reset_passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def edit
analytics.password_reset_token(**result.to_h)
irs_attempts_api_tracker.forgot_password_email_confirmed(
success: result.success?,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(result),
)
if result.success?
@reset_password_form = ResetPasswordForm.new(build_user)
Expand All @@ -52,7 +51,6 @@ def update
analytics.password_reset_password(**result.to_h)
irs_attempts_api_tracker.forgot_password_new_password_submitted(
success: result.success?,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(result),
)

if result.success?
Expand Down Expand Up @@ -117,7 +115,6 @@ def create_account_if_email_not_found
irs_attempts_api_tracker.user_registration_email_submitted(
email: email,
success: result.success?,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(result),
)
create_user_event(:account_created, user)
end
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/users/two_factor_authentication_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,13 @@ def track_events(otp_delivery_preference:, otp_delivery_selection_result:)
reauthentication: true,
phone_number: parsed_phone.e164,
otp_delivery_method: otp_delivery_preference,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(@telephony_result),
)
elsif UserSessionContext.authentication_or_reauthentication_context?(context)
irs_attempts_api_tracker.mfa_login_phone_otp_sent(
success: @telephony_result.success?,
reauthentication: false,
phone_number: parsed_phone.e164,
otp_delivery_method: otp_delivery_preference,
failure_reason: irs_attempts_api_tracker.parse_failure_reason(@telephony_result),
)
elsif UserSessionContext.confirmation_context?(context)
irs_attempts_api_tracker.mfa_enroll_phone_otp_sent(
Expand Down
Loading