diff --git a/app/helpers/text_helper.rb b/app/helpers/text_helper.rb new file mode 100644 index 00000000000..951f2aefa4c --- /dev/null +++ b/app/helpers/text_helper.rb @@ -0,0 +1,12 @@ +module TextHelper + # Adds a "+" character with aria-hidden in front of a string + def prefix_with_plus(str) + safe_join( + [ + content_tag('span', '+', 'aria-hidden': true), + str, + ], + ' ', + ) + end +end diff --git a/app/views/accounts/_auth_apps.html.erb b/app/views/accounts/_auth_apps.html.erb index 2d7658a7e3f..61a5cd22a10 100644 --- a/app/views/accounts/_auth_apps.html.erb +++ b/app/views/accounts/_auth_apps.html.erb @@ -6,7 +6,7 @@ <% if current_user.auth_app_configurations.count < Figaro.env.max_auth_apps_per_account.to_i %>
<%= link_to( - t('forms.buttons.enable'), + prefix_with_plus(t('forms.buttons.enable')), authenticator_setup_url, class: 'btn btn-account-action rounded-lg bg-light-blue', ) %> diff --git a/app/views/accounts/_emails.html.erb b/app/views/accounts/_emails.html.erb index 901cba0c605..3b0b79a41ae 100644 --- a/app/views/accounts/_emails.html.erb +++ b/app/views/accounts/_emails.html.erb @@ -6,7 +6,7 @@
<% if EmailPolicy.new(current_user).can_add_email? %> <%= link_to( - t('account.index.email_add'), + prefix_with_plus(t('account.index.email_add')), add_email_path, class: 'btn btn-account-action rounded-lg bg-light-blue', ) %> diff --git a/app/views/accounts/_phone.html.erb b/app/views/accounts/_phone.html.erb index 2d05259c301..06a7c67ec10 100644 --- a/app/views/accounts/_phone.html.erb +++ b/app/views/accounts/_phone.html.erb @@ -6,7 +6,7 @@
<% if EmailPolicy.new(current_user).can_add_email? %> <%= link_to( - t('account.index.phone_add'), + prefix_with_plus(t('account.index.phone_add')), add_phone_path, class: 'btn btn-account-action rounded-lg bg-light-blue', ) %> diff --git a/app/views/accounts/_piv_cac.html.erb b/app/views/accounts/_piv_cac.html.erb index 4edaa31cece..d3dfde74020 100644 --- a/app/views/accounts/_piv_cac.html.erb +++ b/app/views/accounts/_piv_cac.html.erb @@ -6,7 +6,7 @@ <% if current_user.piv_cac_configurations.count < Figaro.env.max_piv_cac_per_account.to_i %>
<%= link_to( - t('forms.buttons.enable'), + prefix_with_plus(t('forms.buttons.enable')), setup_piv_cac_url, class: 'btn btn-account-action rounded-lg bg-light-blue', ) %> diff --git a/app/views/accounts/_webauthn.html.erb b/app/views/accounts/_webauthn.html.erb index 9623a5b27cd..e3c0d658b69 100644 --- a/app/views/accounts/_webauthn.html.erb +++ b/app/views/accounts/_webauthn.html.erb @@ -5,7 +5,7 @@
<%= link_to( - t('account.index.webauthn_add'), + prefix_with_plus(t('account.index.webauthn_add')), webauthn_setup_path, class: 'btn btn-account-action rounded-lg bg-light-blue', ) %> diff --git a/app/views/accounts/actions/_enable_piv_cac.html.erb b/app/views/accounts/actions/_enable_piv_cac.html.erb index a4f9ab130a8..c7abd2caf22 100644 --- a/app/views/accounts/actions/_enable_piv_cac.html.erb +++ b/app/views/accounts/actions/_enable_piv_cac.html.erb @@ -2,5 +2,5 @@ <%= t('account.index.piv_cac_card') %> - <%= t('forms.buttons.enable') %> + <%= prefix_with_plus(t('forms.buttons.enable')) %> <% end %> diff --git a/app/views/accounts/actions/_enable_totp.html.erb b/app/views/accounts/actions/_enable_totp.html.erb index 66c982ee110..0685d7533b1 100644 --- a/app/views/accounts/actions/_enable_totp.html.erb +++ b/app/views/accounts/actions/_enable_totp.html.erb @@ -1,3 +1,3 @@ <%= link_to authenticator_setup_url, class: 'btn btn-account-action rounded-lg bg-light-blue add-auth-app' do %> - <%= t('forms.buttons.enable') %> + <%= prefix_with_plus(t('forms.buttons.enable')) %> <% end %> diff --git a/app/views/accounts/actions/_generate_backup_codes.html.erb b/app/views/accounts/actions/_generate_backup_codes.html.erb index 77228702afa..2cf34502815 100644 --- a/app/views/accounts/actions/_generate_backup_codes.html.erb +++ b/app/views/accounts/actions/_generate_backup_codes.html.erb @@ -1,2 +1,3 @@ -<%= link_to t('forms.backup_code.generate'), backup_code_create_path, +<%= link_to prefix_with_plus(t('forms.backup_code.generate')), + backup_code_create_path, class: 'btn btn-account-action rounded-lg bg-light-blue' %> diff --git a/app/views/accounts/actions/_regenerate_backup_codes.html.erb b/app/views/accounts/actions/_regenerate_backup_codes.html.erb index 64c961d5661..b5519654d83 100644 --- a/app/views/accounts/actions/_regenerate_backup_codes.html.erb +++ b/app/views/accounts/actions/_regenerate_backup_codes.html.erb @@ -1,3 +1,3 @@ <%= link_to backup_code_regenerate_path, class: 'btn btn-account-action rounded-lg bg-light-blue' do %> - <%= t('forms.backup_code.regenerate') %> + <%= prefix_with_plus(t('forms.backup_code.regenerate')) %> <% end %> diff --git a/config/locales/account/en.yml b/config/locales/account/en.yml index 5aa9a9dfcf2..8432b0fe69e 100644 --- a/config/locales/account/en.yml +++ b/config/locales/account/en.yml @@ -23,12 +23,12 @@ en: device: "%{browser} on %{os}" dob: Date of birth email: Email address - email_add: "+ Add email" + email_add: Add email email_addresses: Email addresses full_name: Full name password: Password phone: Phone numbers - phone_add: "+ Add phone" + phone_add: Add phone piv_cac_card: PIV/CAC Cards piv_cac_confirm_delete: Yes, remove card piv_cac_disabled: not enabled @@ -47,7 +47,7 @@ en: success: Your account has been verified. update_address: Please update your address to be verified. webauthn: Security key - webauthn_add: "+ Add security key" + webauthn_add: Add security key webauthn_confirm_delete: Yes, remove key webauthn_delete: Remove key items: diff --git a/config/locales/account/es.yml b/config/locales/account/es.yml index 6b007a95693..0debcb9d2e7 100644 --- a/config/locales/account/es.yml +++ b/config/locales/account/es.yml @@ -24,12 +24,12 @@ es: device: "%{browser} en %{os}" dob: Fecha de nacimiento email: Correo electrónico - email_add: "+ Agregar email" + email_add: Agregar email email_addresses: Correos electrónicos full_name: Nombre completo password: Contraseña phone: Teléfono - phone_add: "+ Añadir teléfono" + phone_add: Añadir teléfono piv_cac_card: Tarjetas PIV/CAC piv_cac_confirm_delete: Sí, retire la tarjeta piv_cac_disabled: desactivada @@ -49,7 +49,7 @@ es: success: Su cuenta ha sido verificada. update_address: Please update your address to be verified. webauthn: Clave de seguridad - webauthn_add: "+ Añadir clave de seguridad" + webauthn_add: Añadir clave de seguridad webauthn_confirm_delete: Si quitar la llave webauthn_delete: Quitar llave items: diff --git a/config/locales/account/fr.yml b/config/locales/account/fr.yml index ae0787d7597..338cb101630 100644 --- a/config/locales/account/fr.yml +++ b/config/locales/account/fr.yml @@ -24,12 +24,12 @@ fr: device: "%{browser} sur %{os}" dob: Date de naissance email: Adresse courriel - email_add: "+ Ajouter un email" + email_add: Ajouter un email email_addresses: Adresses courriel full_name: Nom complet password: Mot de passe phone: Numéro de téléphone - phone_add: "+ Ajouter un téléphone" + phone_add: Ajouter un téléphone piv_cac_card: Cartes PIV/CAC piv_cac_confirm_delete: Oui, retirer la carte piv_cac_disabled: désactivée @@ -50,7 +50,7 @@ fr: success: Votre compte a été vérifié. update_address: Please update your address to be verified. webauthn: Clé de sécurité - webauthn_add: "+ Ajouter une clé de sécurité" + webauthn_add: Ajouter une clé de sécurité webauthn_confirm_delete: Oui, supprimer la clé webauthn_delete: Supprimer la clé items: diff --git a/config/locales/forms/en.yml b/config/locales/forms/en.yml index 28f18775df4..30dc423e6c6 100644 --- a/config/locales/forms/en.yml +++ b/config/locales/forms/en.yml @@ -21,9 +21,9 @@ en: can sign in again in the future. depleted_title: Create new backup codes download: Download - generate: "+ Get codes" + generate: Get codes print: Print - regenerate: "+ Get new codes" + regenerate: Get new codes subinfo: "Don't lose these codes. Download, print, or copy them. Each code can only be used once. After you’ve used all 10 codes, we’ll give you 10 new codes. Keep your codes as safe as your password." @@ -42,7 +42,7 @@ en: delete: Delete disable: Delete edit: Edit - enable: "+ Add" + enable: Add manage: Manage resend_confirmation: Resend confirmation instructions send_security_code: Send code diff --git a/config/locales/forms/es.yml b/config/locales/forms/es.yml index b209360a5e0..793818da62d 100644 --- a/config/locales/forms/es.yml +++ b/config/locales/forms/es.yml @@ -47,7 +47,7 @@ es: delete: Borrar disable: Borrar edit: Editar - enable: "+ Permitir" + enable: Permitir manage: Administrar resend_confirmation: Reenviar instrucciones de confirmación send_security_code: Enviar código diff --git a/config/locales/forms/fr.yml b/config/locales/forms/fr.yml index efa76f7f378..d56c8bb86c4 100644 --- a/config/locales/forms/fr.yml +++ b/config/locales/forms/fr.yml @@ -46,7 +46,7 @@ fr: delete: Effacer disable: Effacer edit: Modifier - enable: "+ Activer" + enable: Activer manage: Administrer resend_confirmation: Envoyer les instructions de confirmation de nouveau send_security_code: Envoyer le code diff --git a/spec/features/multiple_emails/add_email_spec.rb b/spec/features/multiple_emails/add_email_spec.rb index 30c15d7c710..e2c106a6e5a 100644 --- a/spec/features/multiple_emails/add_email_spec.rb +++ b/spec/features/multiple_emails/add_email_spec.rb @@ -112,7 +112,7 @@ sign_in_and_2fa_user(user) visit account_path - expect(page).to_not have_link(t('account.index.email_add'), href: add_email_path) + expect(page).to_not have_link("+ #{t('account.index.email_add')}", href: add_email_path) end it 'does not allow the user to add an email when max emails is reached' do @@ -128,7 +128,7 @@ user = create(:user, :signed_up) sign_in_and_2fa_user(user) visit account_path - click_link t('account.index.email_add') + click_link "+ #{t('account.index.email_add')}" expect(page).to have_current_path(add_email_path) @@ -142,7 +142,7 @@ user = create(:user, :signed_up) sign_in_and_2fa_user(user) visit account_path - click_link t('account.index.email_add') + click_link "+ #{t('account.index.email_add')}" expect(page).to have_current_path(add_email_path) @@ -188,7 +188,7 @@ sign_in_and_2fa_user(user) visit account_path - click_link t('account.index.email_add') + click_link "+ #{t('account.index.email_add')}" fake_email = instance_double(EmailAddress) expect(fake_email).to receive(:save!).and_raise(ActiveRecord::RecordNotUnique) @@ -207,7 +207,7 @@ def sign_in_user_and_add_email(user, add_email = true) sign_in_and_2fa_user(user) visit account_path - click_link t('account.index.email_add') + click_link "+ #{t('account.index.email_add')}" expect(page).to have_current_path(add_email_path) diff --git a/spec/features/phone/add_phone_spec.rb b/spec/features/phone/add_phone_spec.rb index 42a851e7055..32e9fce1c30 100644 --- a/spec/features/phone/add_phone_spec.rb +++ b/spec/features/phone/add_phone_spec.rb @@ -6,7 +6,7 @@ phone = '+1 (225) 278-1234' sign_in_and_2fa_user(user) - click_on t('account.index.phone_add') + click_on "+ #{t('account.index.phone_add')}" fill_in :new_phone_form_phone, with: phone click_continue fill_in_code_with_last_phone_otp @@ -27,7 +27,7 @@ and_call_original sign_in_and_2fa_user(user) - click_on t('account.index.phone_add') + click_on "+ #{t('account.index.phone_add')}" fill_in :new_phone_form_phone, with: phone click_continue fill_in_code_with_last_phone_otp @@ -39,7 +39,7 @@ phone = user.phone_configurations.first.phone sign_in_and_2fa_user(user) - click_on t('account.index.phone_add') + click_on "+ #{t('account.index.phone_add')}" fill_in :new_phone_form_phone, with: phone click_continue fill_in_code_with_last_phone_otp @@ -54,7 +54,7 @@ user = create(:user, :with_authentication_app) phone = '+1 (225) 278-1234' sign_in_and_2fa_user(user) - click_on t('account.index.phone_add') + click_on "+ #{t('account.index.phone_add')}" fill_in :new_phone_form_phone, with: phone click_continue click_link t('links.cancel') diff --git a/spec/features/phone/confirmation_spec.rb b/spec/features/phone/confirmation_spec.rb index 3fc0b919ffd..f5985f00e5e 100644 --- a/spec/features/phone/confirmation_spec.rb +++ b/spec/features/phone/confirmation_spec.rb @@ -64,7 +64,7 @@ def expect_failed_otp_confirmation(delivery_method) def visit_otp_confirmation(delivery_method) sign_in_live_with_2fa(user) - click_on t('account.index.phone_add') + click_on "+ #{t('account.index.phone_add')}" fill_in :new_phone_form_phone, with: phone select_phone_delivery_option(delivery_method) click_continue diff --git a/spec/features/phone/rate_limitting_spec.rb b/spec/features/phone/rate_limitting_spec.rb index fe850428f07..c923b42c108 100644 --- a/spec/features/phone/rate_limitting_spec.rb +++ b/spec/features/phone/rate_limitting_spec.rb @@ -25,7 +25,7 @@ def visit_otp_confirmation(delivery_method) def visit_otp_confirmation(delivery_method) sign_in_live_with_2fa(user) - click_on t('account.index.phone_add') + click_on "+ #{t('account.index.phone_add')}" fill_in :new_phone_form_phone, with: phone select_phone_delivery_option(delivery_method) click_continue diff --git a/spec/features/remember_device/totp_spec.rb b/spec/features/remember_device/totp_spec.rb index 2244b395984..b7e12c608ea 100644 --- a/spec/features/remember_device/totp_spec.rb +++ b/spec/features/remember_device/totp_spec.rb @@ -48,7 +48,7 @@ def remember_device_and_sign_out_user page.find('.remove-auth-app').click # Delete click_on t('account.index.totp_confirm_delete') Timecop.travel 5.seconds.from_now # Travel past the revoked at date from disabling the device - click_link t('forms.buttons.enable'), href: authenticator_setup_url + click_link "+ #{t('forms.buttons.enable')}", href: authenticator_setup_url fill_in :code, with: totp_secret_from_page check :remember_device click_submit_default diff --git a/spec/features/remember_device/webauthn_spec.rb b/spec/features/remember_device/webauthn_spec.rb index 987616cce60..a56097f11e5 100644 --- a/spec/features/remember_device/webauthn_spec.rb +++ b/spec/features/remember_device/webauthn_spec.rb @@ -57,7 +57,7 @@ def remember_device_and_sign_out_user mock_webauthn_setup_challenge sign_in_and_2fa_user(user) visit account_two_factor_authentication_path - click_link t('account.index.webauthn_add'), href: webauthn_setup_path + click_link "+ #{t('account.index.webauthn_add')}", href: webauthn_setup_path fill_in_nickname_and_click_continue check :remember_device mock_press_button_on_hardware_key_on_setup diff --git a/spec/features/users/totp_management_spec.rb b/spec/features/users/totp_management_spec.rb index 2f3c4dbb3a7..08a86efb96a 100644 --- a/spec/features/users/totp_management_spec.rb +++ b/spec/features/users/totp_management_spec.rb @@ -39,7 +39,7 @@ sign_in_and_2fa_user(user) visit account_two_factor_authentication_path - click_link t('forms.buttons.enable'), href: authenticator_setup_url + click_link "+ #{t('forms.buttons.enable')}", href: authenticator_setup_url secret = find('#qr-code').text fill_in 'code', with: generate_totp_code(secret) @@ -53,14 +53,14 @@ sign_in_and_2fa_user(user) visit account_two_factor_authentication_path - click_link t('forms.buttons.enable'), href: authenticator_setup_url + click_link "+ #{t('forms.buttons.enable')}", href: authenticator_setup_url secret = find('#qr-code').text fill_in 'name', with: 'foo' fill_in 'code', with: generate_totp_code(secret) click_button 'Submit' - click_link t('forms.buttons.enable'), href: authenticator_setup_url + click_link "+ #{t('forms.buttons.enable')}", href: authenticator_setup_url secret = find('#qr-code').text fill_in 'name', with: 'foo' @@ -75,7 +75,7 @@ sign_in_and_2fa_user(user) visit account_two_factor_authentication_path - click_link t('forms.buttons.enable'), href: authenticator_setup_url + click_link "+ #{t('forms.buttons.enable')}", href: authenticator_setup_url secret = find('#qr-code').text fill_in 'name', with: 'foo' @@ -84,7 +84,7 @@ # simulate user delay. totp has a 30 second time step Timecop.travel 30.seconds.from_now do - click_link t('forms.buttons.enable'), href: authenticator_setup_url + click_link "+ #{t('forms.buttons.enable')}", href: authenticator_setup_url secret = find('#qr-code').text fill_in 'name', with: 'bar' @@ -93,7 +93,8 @@ expect(page).to have_current_path(account_two_factor_authentication_path) expect(user.auth_app_configurations.count).to eq(2) - expect(page).to_not have_link(t('forms.buttons.enable'), href: authenticator_setup_url) + expect(page). + to_not have_link("+ #{t('forms.buttons.enable')}", href: authenticator_setup_url) end end end diff --git a/spec/features/webauthn/management_spec.rb b/spec/features/webauthn/management_spec.rb index 044260498e8..6efd492fff8 100644 --- a/spec/features/webauthn/management_spec.rb +++ b/spec/features/webauthn/management_spec.rb @@ -11,7 +11,7 @@ def visit_webauthn_setup sign_in_and_2fa_user(user) visit account_two_factor_authentication_path - click_link t('account.index.webauthn_add'), href: webauthn_setup_path + click_link "+ #{t('account.index.webauthn_add')}", href: webauthn_setup_path end def expect_webauthn_setup_success @@ -111,7 +111,7 @@ def expect_webauthn_setup_error visit account_two_factor_authentication_path expect(current_path).to eq account_two_factor_authentication_path - click_link t('account.index.webauthn_add'), href: webauthn_setup_path + click_link "+ #{t('account.index.webauthn_add')}", href: webauthn_setup_path expect(current_path).to eq webauthn_setup_path fill_in_nickname_and_click_continue(nickname: webauthn_config.name)