Skip to content

Commit

Permalink
LG-1550 Conditionally ask account reset users for personal key (#3100)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevegsa authored Jul 16, 2019
1 parent 2012331 commit 9cd0046
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 22 deletions.
28 changes: 15 additions & 13 deletions app/views/account_reset/request/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@

h3.my0 = t('account_reset.request.title')
p.mt-tiny.mb0 == t('account_reset.request.info')
br
h4.my0 = t('account_reset.request.personal_key')
- if current_user&.encrypted_recovery_code_digest&.present?
br
h4.my0 = t('account_reset.request.personal_key')

p.mt-tiny.mb0
= t('account_reset.request.personal_key_info')
p.mt-tiny.mb0
= t('account_reset.request.personal_key_info')

hr
= render 'partials/personal_key/key', code: 'XXXX-XXXX-XXXX-XXXX'
hr
= render 'partials/personal_key/key', code: 'XXXX-XXXX-XXXX-XXXX'

.mb3.right-align
.mb3.right-align

= link_to t('users.personal_key.print'), '#',
data: { print: true },
class: 'ml2 btn-border ico ico-print text-decoration-none'
= link_to t('users.personal_key.print'), '#',
data: { print: true },
class: 'ml2 btn-border ico ico-print text-decoration-none'

hr
p.mt-tiny.mb0 == t('account_reset.request.personal_key_trailer', \
link: link_to(t('account_reset.request.access_your_account'), login_two_factor_personal_key_url))
hr
p.mt-tiny.mb0 == t('account_reset.request.personal_key_trailer', \
link: link_to(t('account_reset.request.access_your_account'), \
login_two_factor_personal_key_url))
br
h4.my0 = t('account_reset.request.delete_account')
p.mt-tiny.mb0 == t('account_reset.request.delete_account_info')
Expand Down
5 changes: 2 additions & 3 deletions config/locales/account_reset/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ en:
request:
access_your_account: access your account
are_you_sure: Are you sure you don't have access to any of your authentication
methods OR your personal key?
methods?
delete_account: Delete your account
delete_account_info: Deleting your existing account and creating a new one will
allow you to use the same email address and set up new authentication methods. However,
Expand All @@ -41,8 +41,7 @@ en:
info: If you can't access your account using the authentication methods you
set up previously, deleting your account and creating a new one is the only
option. <br><br> We can't undo an account delete, so please verify if you
have another authentication method you can use instead, such as your personal
key.
have another authentication method you can use instead.
no_cancel: No, cancel
personal_key: Do you have your personal key?
personal_key_info: Your personal key is a 16 character code that was given to
Expand Down
5 changes: 2 additions & 3 deletions config/locales/account_reset/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ es:
request:
access_your_account: acceder a tu cuenta
are_you_sure: "¿Estás seguro de que no tienes acceso a ninguno de tus métodos
de seguridad? O tu clave personal?"
de seguridad?"
delete_account: Eliminar su cuenta
delete_account_info: Eliminar su cuenta existente y crear una nueva         
le permite usar la misma dirección de correo electrónico y configurar nuevas
Expand All @@ -43,8 +43,7 @@ es:
info: Si no puede acceder a su cuenta a través de las opciones de seguridad
que configuró anteriormente, eliminar la cuenta y crear una nueva es la única
opción. <br><br> No podemos deshacer la eliminación de una cuenta, así que
por favor asegúrese de no tener otra opción de seguridad que puede usar como
su clave personal.
por favor asegúrese de no tener otra opción de seguridad que puede usar.
no_cancel: No, cancelar
personal_key: "¿Tienes tu clave personal?"
personal_key_info: Su clave personal es un código de 16 caracteres que se le
Expand Down
4 changes: 1 addition & 3 deletions config/locales/account_reset/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ fr:
request:
access_your_account: accéder à votre compte
are_you_sure: Êtes-vous sûr de n'avoir accès à aucune de vos méthodes de sécurité?
OU votre clé personnelle?
delete_account: Supprimer votre compte
delete_account_info: Supprimer votre compte existant et en créer un nouveau
vous permet d'utiliser la même adresse e-mail et de définir de nouvelles options
Expand All @@ -45,8 +44,7 @@ fr:
que vous avez définies auparavant, la suppression de votre compte et la création
d'un nouveau compte est la seule option. <br><br> Nous ne pouvons pas annuler
un compte supprimer, alors s'il vous plaît assurez-vous que vous n'avez pas
une autre option de sécurité que vous pouvez utiliser à la place comme votre
clé personnelle.
une autre option de sécurité que vous pouvez utiliser à la place.
no_cancel: Non, annuler
personal_key: Avez-vous votre clé personnelle?
personal_key_info: Votre clé personnelle est un code de 16 caractères qui a
Expand Down
19 changes: 19 additions & 0 deletions spec/views/account_reset/request/show.html.slim_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
require 'rails_helper'

describe 'account_reset/request/show.html.slim' do
before do
user = create(:user, :signed_up)
allow(view).to receive(:current_user).and_return(user)
end

it 'has a localized title' do
expect(view).to receive(:title).with(t('account_reset.request.title'))

Expand All @@ -11,4 +16,18 @@
render
expect(rendered).to have_button t('account_reset.request.yes_continue')
end

it 'shows personal key info when a user has a personal key' do
render
expect(rendered).to have_content(t('account_reset.request.personal_key'))
end

it 'does not show personal key info when a user does not have a personal key' do
user = view.current_user
user.encrypted_recovery_code_digest = ''
user.save

render
expect(rendered).to_not have_content(t('account_reset.request.personal_key'))
end
end

0 comments on commit 9cd0046

Please sign in to comment.