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
12 changes: 12 additions & 0 deletions app/helpers/text_helper.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion app/views/accounts/_auth_apps.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<% if current_user.auth_app_configurations.count < Figaro.env.max_auth_apps_per_account.to_i %>
<div class="right-align grid-col-6">
<%= 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',
) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/_emails.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="right-align col col-6">
<% 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',
) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/_phone.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="right-align grid-col-6">
<% 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',
) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/_piv_cac.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<% if current_user.piv_cac_configurations.count < Figaro.env.max_piv_cac_per_account.to_i %>
<div class="right-align grid-col-6">
<%= 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',
) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/_webauthn.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</h2>
<div class="right-align grid-col-6">
<%= 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',
) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/actions/_enable_piv_cac.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<span class="hide">
<%= t('account.index.piv_cac_card') %>
</span>
<%= t('forms.buttons.enable') %>
<%= prefix_with_plus(t('forms.buttons.enable')) %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/accounts/actions/_enable_totp.html.erb
Original file line number Diff line number Diff line change
@@ -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 %>
3 changes: 2 additions & 1 deletion app/views/accounts/actions/_generate_backup_codes.html.erb
Original file line number Diff line number Diff line change
@@ -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' %>
Original file line number Diff line number Diff line change
@@ -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 %>
6 changes: 3 additions & 3 deletions config/locales/account/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions config/locales/account/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions config/locales/account/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions config/locales/forms/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: "<b>Don't lose these codes</b>. 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."
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/locales/forms/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/locales/forms/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions spec/features/multiple_emails/add_email_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand All @@ -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)

Expand Down Expand Up @@ -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)
Expand All @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions spec/features/phone/add_phone_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion spec/features/phone/confirmation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/features/phone/rate_limitting_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/features/remember_device/totp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/features/remember_device/webauthn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions spec/features/users/totp_management_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/features/webauthn/management_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down