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
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ def header
t('two_factor_authentication.totp_header_text')
end

def help_text
t(
'instructions.mfa.authenticator.confirm_code_html',
app_name_html: content_tag(:strong, APP_NAME),
)
end

def fallback_question
t('two_factor_authentication.totp_fallback.question')
end
Expand Down
4 changes: 0 additions & 4 deletions app/presenters/two_factor_auth_code/backup_code_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ module TwoFactorAuthCode
class BackupCodePresenter < TwoFactorAuthCode::GenericDeliveryPresenter
include ActionView::Helpers::TranslationHelper

def help_text
''
end

def cancel_link
if reauthn
account_path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ def header
raise NotImplementedError
end

def help_text
raise NotImplementedError
end

def link_text
t('two_factor_authentication.login_options_link_text')
end
Expand Down
4 changes: 0 additions & 4 deletions app/presenters/two_factor_auth_code/personal_key_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ module TwoFactorAuthCode
class PersonalKeyPresenter < TwoFactorAuthCode::GenericDeliveryPresenter
def initialize; end

def help_text
''
end

def fallback_question
t('two_factor_authentication.personal_key_fallback.question')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ def fallback_question
t('two_factor_authentication.phone_fallback.question')
end

def help_text
''
end

def troubleshooting_header
t('components.troubleshooting_options.default_heading')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ def piv_cac_help
end
end

def help_text
''
end

def piv_cac_capture_text
t('forms.piv_cac_mfa.submit')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ def authenticate_button_text
end
end

def help_text
''
end

def header
if platform_authenticator?
t('two_factor_authentication.webauthn_platform_header_text')
Expand Down
5 changes: 1 addition & 4 deletions app/views/shared/_fallback_links.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<div class="margin-top-5">
<% if @presenter.help_text.present? %>
<p><%= @presenter.help_text %></p>
<% end %>
<div>
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.

This could be removed, but I chose not to do it here in order to simplify the diff. It'll be removed in the next step, where we'll remove this view entirely and replace it with a troubleshooting options component.

<h2 class="h3 margin-top-4 margin-bottom-1">
<%= @presenter.fallback_question %>
</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
html: { autocomplete: 'off', method: :post },
) do |f| %>
<%= render 'partials/backup_code/entry_fields', f: f, attribute_name: :backup_code %>
<%= f.submit t('forms.buttons.submit.default') %>
<%= f.submit t('forms.buttons.submit.default'), class: 'display-block margin-y-5' %>
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.

The changes here and the next two files are to maintain the vertical margin that was previously applied by _fallback_links.html.erb.

<% end %>

<%= render 'shared/fallback_links', presenter: @presenter %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
html: { autocomplete: 'off', method: :post }
) do |f| %>
<%= render 'partials/personal_key/entry_fields', f: f, attribute_name: :personal_key %>
<%= f.submit t('forms.buttons.submit.default') %>
<%= f.submit t('forms.buttons.submit.default'), class: 'display-block margin-y-5' %>
<% end %>

<%= render 'shared/fallback_links', presenter: @presenter %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
<%= @presenter.piv_cac_help %>
</p>

<%= render SpinnerButtonComponent.new(
action: ->(**tag_options, &block) do
link_to(@presenter.piv_cac_service_link, **tag_options, &block)
end,
big: true,
wide: true,
).with_content(@presenter.piv_cac_capture_text) %>
<div class="margin-y-5">
<%= render SpinnerButtonComponent.new(
action: ->(**tag_options, &block) do
link_to(@presenter.piv_cac_service_link, **tag_options, &block)
end,
big: true,
wide: true,
).with_content(@presenter.piv_cac_capture_text) %>
</div>
<%= render 'shared/fallback_links', presenter: @presenter %>
<%= render 'shared/cancel', link: @presenter.cancel_link %>
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,12 @@
<%= f.submit t('forms.buttons.submit.default'), class: 'display-block margin-top-5' %>
<% end %>

<p>
<%= t(
'instructions.mfa.authenticator.confirm_code_html',
app_name_html: content_tag(:strong, APP_NAME),
) %>
</p>

<%= render 'shared/fallback_links', presenter: @presenter %>
<%= render 'shared/cancel', link: @presenter.cancel_link %>
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,4 @@
'/account'
end
end

describe '#help_text' do
it 'returns blank' do
expect(presenter.help_text).to eq ''
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
it 'is an abstract presenter with methods that should be implemented' do
presenter = presenter_with

%w[header help_text fallback_links].each do |m|
%w[header fallback_links].each do |m|
expect { presenter.send(m.to_sym) }.to raise_error(NotImplementedError)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,4 @@
t('two_factor_authentication.personal_key_fallback.question')
end
end

describe '#help_text' do
it 'returns blank' do
expect(presenter.help_text).to eq ''
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@
end
end

describe 'help_text' do
it 'supplies no help text' do
expect(presenter.help_text).to eq('')
end
end

describe '#link_text' do
let(:phishing_resistant_required) { true }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,6 @@
end
end

describe '#help_text' do
it 'supplies no help text' do
expect(presenter.help_text).to eq('')
end
end

describe '#link_text' do
let(:phishing_resistant_required) { true }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,16 @@
end
end

context 'OTP copy' do
let(:help_text) do
it 'informs the user that an OTP has been sent to their number' do
render

expect(rendered).to include(
t(
'instructions.mfa.sms.number_message_html',
number_html: content_tag(:strong, presenter_data[:phone_number]),
expiration: TwoFactorAuthenticatable::DIRECT_OTP_VALID_FOR_MINUTES,
)
end

it 'informs the user that an OTP has been sent to their number via #help_text' do
render

expect(rendered).to include help_text
end

context 'in other locales' do
before { I18n.locale = :es }

it 'translates correctly' do
render

expect(rendered).to include help_text
end
end
),
)
end

context 'user signed up' do
Expand Down