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 @@ -7,15 +7,22 @@ def header
t('two_factor_authentication.piv_cac_header_text')
end

def help_text
def piv_cac_help
if service_provider_mfa_policy.aal3_required? &&
!service_provider_mfa_policy.allow_user_to_switch_method?
service_provider_mfa_policy.allow_user_to_switch_method?
t('instructions.mfa.piv_cac.confirm_piv_cac_or_aal3_html')
elsif service_provider_mfa_policy.aal3_required? ||
service_provider_mfa_policy.piv_cac_required?
t('instructions.mfa.piv_cac.confirm_piv_cac_only_html')
else
t('instructions.mfa.piv_cac.confirm_piv_cac_html')
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 @@ -7,7 +7,10 @@ class WebauthnAuthenticationPresenter < TwoFactorAuthCode::GenericDeliveryPresen
attr_reader :credential_ids, :user_opted_remember_device_cookie

def webauthn_help
if service_provider_mfa_policy.allow_user_to_switch_method?
if service_provider_mfa_policy.aal3_required? &&
service_provider_mfa_policy.allow_user_to_switch_method?
t('instructions.mfa.webauthn.confirm_webauthn_or_aal3_html')
elsif service_provider_mfa_policy.aal3_required?
t('instructions.mfa.webauthn.confirm_webauthn_only_html')
else
t('instructions.mfa.webauthn.confirm_webauthn_html')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</h1>
<div class='no-spinner'>
<p class='mt-tiny mb3'>
<%= @presenter.help_text %>
<%= @presenter.piv_cac_help %>
</p>

<%= link_to @presenter.piv_cac_capture_text,
Expand Down
8 changes: 7 additions & 1 deletion config/locales/instructions/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ en:
confirm_piv_cac_html: Present the PIV/CAC that you associated with your account.
confirm_piv_cac_only_html: This app requires a higher level of security. You
need to verify your identity using a government employee ID that you previously
set up to access your information
set up to access your information.
confirm_piv_cac_or_aal3_html: This app requires a higher level of security.
You need to verxify your identity using a physical device such as a security
key or government employee ID (PIV/CAC) to access your information.
did_not_work: There may be a problem with your PIV/CAC or PIN. If you think
this is an error, %{try_again}. If this problem continues, contact your
agency administrator.
Expand Down Expand Up @@ -66,6 +69,9 @@ en:
confirm_webauthn_only_html: This app requires a higher level of security.
You need to verify your identity using a security key that you previously
set up to access your information.
confirm_webauthn_or_aal3_html: This app requires a higher level of security.
You need to verxify your identity using a physical device such as a security
key or government employee ID (PIV/CAC) to access your information.
wrong_number_html: Entered the wrong phone number? %{link}
password:
forgot: Don’t know your password? Reset it after confirming your email address.
Expand Down
10 changes: 9 additions & 1 deletion config/locales/instructions/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ es:
confirm_piv_cac_html: Presenta la PIV/CAC que asociaste con tu cuenta.
confirm_piv_cac_only_html: Esta aplicación requiere un mayor nivel de seguridad.
Debe verificar su identidad utilizando una identificación de empleado del
gobierno que configuró previamente para acceder a su información
gobierno que configuró previamente para acceder a su información.
confirm_piv_cac_or_aal3_html: Esta aplicación requiere un mayor nivel de seguridad.
Debe verificar su identidad mediante un dispositivo físico, como una llave
de seguridad o una identificación de empleado del gobierno (PIV / CAC) para
acceder a su información.
did_not_work: Puede haber un problema con su PIV / CAC o PIN. Si cree que
esto es un error, %{try_again}. Si este problema continúa, comuníquese
con el administrador de su agencia.
Expand Down Expand Up @@ -66,6 +70,10 @@ es:
confirm_webauthn_only_html: Esta aplicación requiere un mayor nivel de seguridad.
Debe verificar su identidad utilizando una clave de seguridad que configuró
previamente para acceder a su información.
confirm_webauthn_or_aal3_html: Esta aplicación requiere un mayor nivel de
seguridad. Debe verificar su identidad mediante un dispositivo físico, como
una llave de seguridad o una identificación de empleado del gobierno (PIV
/ CAC) para acceder a su información.
wrong_number_html: "¿Ingresó el número de teléfono equivocado? %{link}"
password:
forgot: "¿No sabe su contraseña? Restablézcala después de confirmar su email."
Expand Down
21 changes: 15 additions & 6 deletions config/locales/instructions/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ fr:
back_to_sign_in: Retourner à vous connecter
confirm_piv_cac_html: Veuillez présenter la carte PIV/CAC que vous avez associée
à votre compte.
confirm_piv_cac_only_html: Esta aplicación requiere un mayor nivel de seguridad.
Debe verificar su identidad utilizando una identificación de empleado del
gobierno que configuró previamente para acceder a su información
confirm_piv_cac_only_html: Cette application nécessite un niveau de sécurité
plus élevé. Vous devez vérifier votre identité à l'aide d'un identifiant
d'employé du gouvernement que vous avez précédemment configuré pour accéder
à vos informations.
confirm_piv_cac_or_aal3_html: Cette application nécessite un niveau de sécurité
plus élevé. Vous devez vérifier votre identité à l'aide d'un appareil physique
tel qu'une clé de sécurité ou un identifiant d'employé du gouvernement (PIV
/ CAC) pour accéder à vos informations.
did_not_work: Il peut y avoir un problème avec votre PIV / CAC ou votre code
PIN. Si vous pensez que c'est une erreur, %{try_again}. Si le problème
persiste, contactez l'administrateur de votre agence.
Expand Down Expand Up @@ -70,9 +75,13 @@ fr:
number_message_html: Nous venons de vous appeler à %{number}.
webauthn:
confirm_webauthn_html: Présentez la clé de sécurité associée à votre compte.
confirm_webauthn_only_html: Esta aplicación requiere un mayor nivel de seguridad.
Debe verificar su identidad utilizando una clave de seguridad que configuró
previamente para acceder a su información.
confirm_webauthn_only_html: Cette application nécessite un niveau de sécurité
plus élevé. Vous devez vérifier votre identité à l'aide d'une clé de sécurité
que vous avez précédemment configurée pour accéder à vos informations.
confirm_webauthn_or_aal3_html: Cette application nécessite un niveau de sécurité
plus élevé. Vous devez vérifier votre identité à l'aide d'un appareil physique
tel qu'une clé de sécurité ou un identifiant d'employé du gouvernement (PIV
/ CAC) pour accéder à vos informations.
wrong_number_html: Vous avez entré un mauvais numéro de téléphone? %{link}
password:
forgot: Vous ne connaissez pas votre mot de passe? Réinitialisez-le après avoir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ def presenter_with(arguments = {}, view = ActionController::Base.new.view_contex

let(:allow_user_to_switch_method) { false }
let(:aal3_required) { true }
let(:piv_cac_required) { false }
let(:service_provider_mfa_policy) do
instance_double(ServiceProviderMfaPolicy,
aal3_required?: aal3_required,
piv_cac_required?: piv_cac_required,
allow_user_to_switch_method?: allow_user_to_switch_method)
end

Expand All @@ -32,31 +34,76 @@ def presenter_with(arguments = {}, view = ActionController::Base.new.view_contex
it { expect(presenter.header).to eq expected_header }
end

describe '#help_text' do
let(:expected_help_text) do
t('instructions.mfa.piv_cac.confirm_piv_cac_html',
describe '#piv_cac_help' do
let(:aal3_required) { false }
let(:piv_cac_required) { false }

it 'returns help text' do
expected_help_text = t(
'instructions.mfa.piv_cac.confirm_piv_cac_html',
email: content_tag(:strong, user_email),
app: content_tag(:strong, APP_NAME))
app: content_tag(:strong, APP_NAME),
)
expect(presenter.piv_cac_help).to eq expected_help_text
end

context 'with AAL3 required, and only one method enabled' do
context 'with PIV/CAC only requested' do
let(:aal3_required) { true }
let(:piv_cac_required) { true }

context 'with a user who only has a PIV' do
let(:allow_user_to_switch_method) { false }

let(:expected_help_text) do
t('instructions.mfa.piv_cac.confirm_piv_cac_only_html')
it 'returns the PIV only help text' do
expect(presenter.piv_cac_help).to eq(
t('instructions.mfa.piv_cac.confirm_piv_cac_only_html'),
)
end
end
it 'finds the PIV/CAC only help text' do
expect(presenter.help_text).to eq expected_help_text

context 'with a user who has a PIV and security key' do
let(:allow_user_to_switch_method) { false }

it 'returns the PIV only help text' do
expect(presenter.piv_cac_help).to eq(
t('instructions.mfa.piv_cac.confirm_piv_cac_only_html'),
)
end
end
end
context 'without AAL3 required' do
let(:aal3_required) { false }
it 'finds the help text' do
expect(presenter.help_text).to eq expected_help_text

context 'with AAL3 requested' do
let(:aal3_required) { true }
let(:piv_cac_required) { false }

context 'with a user who only has a PIV' do
let(:allow_user_to_switch_method) { false }

it 'returns the PIV only help text' do
expect(presenter.piv_cac_help).to eq(
t('instructions.mfa.piv_cac.confirm_piv_cac_only_html'),
)
end
end

context 'with a user who has a PIV and security key' do
let(:allow_user_to_switch_method) { true }

it 'returns the PIV or AAL3 help text' do
expect(presenter.piv_cac_help).to eq(
t('instructions.mfa.piv_cac.confirm_piv_cac_or_aal3_html'),
)
end
end
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(:aal3_required) { true }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,43 @@
allow(presenter).to receive(:service_provider_mfa_policy).and_return service_provider_mfa_policy
end

describe '#webauthn_help' do
context 'with aal3 required' do
let(:aal3_required) { true }

context 'the user only has a security key enabled' do
let(:allow_user_to_switch_method) { false }

it 'returns the help text for just the security key' do
expect(presenter.webauthn_help).to eq(
t('instructions.mfa.webauthn.confirm_webauthn_only_html'),
)
end
end

context 'the user has a security key and PIV enabled' do
let(:allow_user_to_switch_method) { true }

it 'returns the help text for the security key or PIV' do
expect(presenter.webauthn_help).to eq(
t('instructions.mfa.webauthn.confirm_webauthn_or_aal3_html'),
)
end
end
end

context 'with aal3 not required' do
let(:aal3_required) { false }

it 'displays the help text' do
expect(presenter.webauthn_help).to eq(
t('instructions.mfa.webauthn.confirm_webauthn_html'),
)
end
end
end

describe '#help_text' do
context 'with aal3 required'
it 'supplies no help text' do
expect(presenter.help_text).to eq('')
end
Expand Down