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
13 changes: 3 additions & 10 deletions app/controllers/concerns/two_factor_authenticatable_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,6 @@ def otp_expiration
current_user.direct_otp_sent_at + TwoFactorAuthenticatable::DIRECT_OTP_VALID_FOR_SECONDS
end

def personal_key_unavailable?
current_user.encrypted_recovery_code_digest.blank?
end

def user_opted_remember_device_cookie
cookies.encrypted[:user_opted_remember_device_preference]
end
Expand All @@ -305,15 +301,14 @@ def unconfirmed_phone?
end

def phone_view_data
Copy link
Copy Markdown
Contributor

@zachmargolis zachmargolis Feb 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was like "oh nothing seems to call this" and then I remembered what mixin we're in with dynamic sends everywhere 😎 😭

data = send("#{type}_view_data".to_sym)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, would like to redo this whole thing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BIG SAME

{ confirmation_for_add_phone: confirmation_for_add_phone?,
{
confirmation_for_add_phone: confirmation_for_add_phone?,
phone_number: display_phone_to_deliver_to,
code_value: direct_otp_code,
otp_expiration: otp_expiration,
otp_delivery_preference: two_factor_authentication_method,
otp_make_default_number: selected_otp_make_default_number,
voice_otp_delivery_unsupported: voice_otp_delivery_unsupported?,
unconfirmed_phone: unconfirmed_phone?,
account_reset_token: account_reset_token }.merge(generic_data)
Comment on lines -314 to -316
Copy link
Copy Markdown
Contributor

@aduth aduth Feb 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • unconfirmed_phone was still used in PhoneDeliveryPresenter (source), follow-up at LG-9037: Unconfirmed Phone fix #7884
  • voice_otp_delivery_unsupported? and account_reset_token methods appear to be unused in this class now

}.merge(generic_data)
end

def selected_otp_make_default_number
Expand All @@ -333,8 +328,6 @@ def authenticator_view_data

def generic_data
{
personal_key_unavailable: personal_key_unavailable?,
reauthn: reauthn?,
user_opted_remember_device_cookie: user_opted_remember_device_cookie,
}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def piv_cac_view_data
{
two_factor_authentication_method: two_factor_authentication_method,
hide_fallback_question: service_provider_mfa_policy.piv_cac_required?,
user_email: current_user.email_addresses.take.email,
}.merge(generic_data)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ def service_provider_mfa_policy
)
end

attr_reader :personal_key_unavailable, :view, :user_opted_remember_device_cookie
attr_reader :view, :user_opted_remember_device_cookie
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ def troubleshoot_change_phone_or_method_option

attr_reader(
:phone_number,
:account_reset_token,
:confirmation_for_add_phone,
:voice_otp_delivery_unsupported,
)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
phone_number: '5555559876',
code_value: '999999',
otp_delivery_preference: 'sms',
unconfirmed_phone: true,
totp_enabled: false,
personal_key_unavailable: true,
reauthn: false,
}
end
let(:presenter) do
Expand Down