diff --git a/app/presenters/two_factor_auth_code/piv_cac_authentication_presenter.rb b/app/presenters/two_factor_auth_code/piv_cac_authentication_presenter.rb index fe07528492b..f4334f627d5 100644 --- a/app/presenters/two_factor_auth_code/piv_cac_authentication_presenter.rb +++ b/app/presenters/two_factor_auth_code/piv_cac_authentication_presenter.rb @@ -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 diff --git a/app/presenters/two_factor_auth_code/webauthn_authentication_presenter.rb b/app/presenters/two_factor_auth_code/webauthn_authentication_presenter.rb index cf962667010..3cc4ed7f6ce 100644 --- a/app/presenters/two_factor_auth_code/webauthn_authentication_presenter.rb +++ b/app/presenters/two_factor_auth_code/webauthn_authentication_presenter.rb @@ -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') diff --git a/app/views/two_factor_authentication/piv_cac_verification/show.html.erb b/app/views/two_factor_authentication/piv_cac_verification/show.html.erb index c113cee0cdf..bac070645f5 100644 --- a/app/views/two_factor_authentication/piv_cac_verification/show.html.erb +++ b/app/views/two_factor_authentication/piv_cac_verification/show.html.erb @@ -5,7 +5,7 @@
- <%= @presenter.help_text %> + <%= @presenter.piv_cac_help %>
<%= link_to @presenter.piv_cac_capture_text, diff --git a/config/locales/instructions/en.yml b/config/locales/instructions/en.yml index 98575f722fb..31ec54a3661 100644 --- a/config/locales/instructions/en.yml +++ b/config/locales/instructions/en.yml @@ -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. @@ -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. diff --git a/config/locales/instructions/es.yml b/config/locales/instructions/es.yml index 4a3ce820f36..2420ceac182 100644 --- a/config/locales/instructions/es.yml +++ b/config/locales/instructions/es.yml @@ -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. @@ -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." diff --git a/config/locales/instructions/fr.yml b/config/locales/instructions/fr.yml index 750671a08a7..a81849e6bc5 100644 --- a/config/locales/instructions/fr.yml +++ b/config/locales/instructions/fr.yml @@ -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. @@ -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 diff --git a/spec/presenters/two_factor_auth_code/piv_cac_authentication_presenter_spec.rb b/spec/presenters/two_factor_auth_code/piv_cac_authentication_presenter_spec.rb index 0b4a4dab33b..c7a79113f77 100644 --- a/spec/presenters/two_factor_auth_code/piv_cac_authentication_presenter_spec.rb +++ b/spec/presenters/two_factor_auth_code/piv_cac_authentication_presenter_spec.rb @@ -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 @@ -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 } diff --git a/spec/presenters/two_factor_auth_code/webauthn_authentication_presenter_spec.rb b/spec/presenters/two_factor_auth_code/webauthn_authentication_presenter_spec.rb index bdda380e96e..3dd7a3608e3 100644 --- a/spec/presenters/two_factor_auth_code/webauthn_authentication_presenter_spec.rb +++ b/spec/presenters/two_factor_auth_code/webauthn_authentication_presenter_spec.rb @@ -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