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
9 changes: 9 additions & 0 deletions app/presenters/webauthn_setup_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ def image_path
end
end

def page_title
if @platform_authenticator
# Note: The following title is incorrect and awaiting copy
t('headings.webauthn_platform_setup.new')
else
t('titles.webauthn_setup')
end
end

def heading
if @platform_authenticator
t('headings.webauthn_platform_setup.new')
Expand Down
2 changes: 2 additions & 0 deletions app/views/users/backup_code_setup/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% title t('forms.backup_code.are_you_sure_title') %>

<%= render PageHeadingComponent.new.with_content(t('forms.backup_code.are_you_sure_title')) %>

<% t('forms.backup_code.are_you_sure_desc_html').each do |desc_p| %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/webauthn_setup/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% title t('titles.totp_setup.new') %>
<% title @presenter.page_title %>

<%= image_tag asset_url(@presenter.image_path), alt: '', width: '90', class: 'margin-left-1 margin-bottom-2' %>

Expand Down
1 change: 1 addition & 0 deletions config/locales/titles/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ en:
verify_profile: Activate your account
visitors:
index: Welcome
webauthn_setup: Add your security key
1 change: 1 addition & 0 deletions config/locales/titles/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ es:
verify_profile: Active su cuenta
visitors:
index: Bienvenido/a
webauthn_setup: Añade tu clave de seguridad
1 change: 1 addition & 0 deletions config/locales/titles/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ fr:
verify_profile: Activez votre compte
visitors:
index: Bienvenue
webauthn_setup: Ajoutez votre clé de sécurité
16 changes: 14 additions & 2 deletions spec/presenters/webauthn_setup_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@
describe '#image_path' do
subject { presenter.image_path }

it { is_expected.to eq('security-key.svg') }
it { is_expected.to eq('security-key.svg') }
end

describe '#page_title' do
subject { presenter.page_title }

it { is_expected.to eq(t('titles.webauthn_setup')) }
end

describe '#heading' do
Expand Down Expand Up @@ -71,7 +77,13 @@
describe '#image_path' do
subject { presenter.image_path }

it { is_expected.to eq('platform-authenticator.svg') }
it { is_expected.to eq('platform-authenticator.svg') }
end

describe '#page_title' do
subject { presenter.page_title }

it { is_expected.to eq(t('headings.webauthn_platform_setup.new')) }
end

describe '#heading' do
Expand Down
17 changes: 17 additions & 0 deletions spec/views/users/backup_code_setup/index.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'rails_helper'

describe 'users/backup_code_setup/index.html.erb' do
let(:user) { build(:user) }

before do
allow(view).to receive(:current_user).and_return(user)
end

it 'has a localized title' do
expect(view).to receive(:title).with(
t('forms.backup_code.are_you_sure_title'),
)

render
end
end
6 changes: 6 additions & 0 deletions spec/views/users/webauthn_setup/new.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
assign(:presenter, presenter)
end

it 'has a localized title' do
expect(view).to receive(:title).with(presenter.page_title)

render
end

it 'displays warning alert' do
render

Expand Down