Skip to content
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
d981422
LG-7353 First changes
jmax-gsa Oct 3, 2022
9ef0c53
More UI tweaks.
jmax-gsa Oct 4, 2022
59f3263
Moved strings out to new locale file entries.
jmax-gsa Oct 4, 2022
206b2dd
Use ValidatedFieldComponent for acknowledgement checkbox.
jmax-gsa Oct 5, 2022
dbfa7a4
French and Spanish strings
jmax-gsa Oct 5, 2022
97b5868
Spec and implementation for tracking personal key acknowledgments
jmax-gsa Oct 5, 2022
9a0b129
Lint nits
jmax-gsa Oct 7, 2022
47f7a50
Lint/Yaml complaints
jmax-gsa Oct 7, 2022
164928b
Removed unused log controller map entries
jmax-gsa Oct 7, 2022
5ee50d1
Fixed incorrect element id
jmax-gsa Oct 7, 2022
2f545fc
Typo.
jmax-gsa Oct 7, 2022
aa96f39
Test fix.
jmax-gsa Oct 7, 2022
2ab80a5
Removed unused strings
jmax-gsa Oct 12, 2022
fc4b574
Checkin to push
jmax-gsa Oct 12, 2022
0f3b0c6
Pass update_path through to simple_form_for
jmax-gsa Oct 12, 2022
481be99
Forcibly prevent personal key confirmation dialog.
jmax-gsa Oct 12, 2022
24e59bd
Typo
jmax-gsa Oct 12, 2022
3d45c3c
Removed shared examples for personal keys
jmax-gsa Oct 12, 2022
e0264bb
Personal key confirmation tests
jmax-gsa Oct 12, 2022
fffb7ca
Actually check the checkbox
jmax-gsa Oct 12, 2022
fc8e1ef
Removed unused string
jmax-gsa Oct 12, 2022
ec9a9a6
Fixed broken specs
jmax-gsa Oct 12, 2022
611bb17
Lint nits
jmax-gsa Oct 12, 2022
c44efd3
Absolutely trivial lint nit
jmax-gsa Oct 12, 2022
360b1b4
Spec fixes.
jmax-gsa Oct 12, 2022
ef4c8b2
Removed dead code
jmax-gsa Oct 12, 2022
872eb24
More dead code removal
jmax-gsa Oct 12, 2022
d5597e0
Still more dead code
jmax-gsa Oct 12, 2022
2b9f1c1
Fix spec broken by rebase onto current master
jmax-gsa Oct 12, 2022
b1db85f
Update app/javascript/packs/personal-key-page-controller.js
jmax-gsa Oct 14, 2022
0cb10c4
Update app/views/shared/_personal_key.html.erb
jmax-gsa Oct 14, 2022
72b0a3a
Update app/views/shared/_personal_key.html.erb
jmax-gsa Oct 14, 2022
8acd636
Update app/views/partials/personal_key/_key.html.erb
jmax-gsa Oct 14, 2022
b558b21
Update app/views/shared/_personal_key.html.erb
jmax-gsa Oct 14, 2022
82ea487
Update app/views/shared/_personal_key.html.erb
jmax-gsa Oct 14, 2022
05bca60
Update app/views/shared/_personal_key.html.erb
jmax-gsa Oct 14, 2022
756e2f4
Review comment
jmax-gsa Oct 13, 2022
64adfdd
Review comment
jmax-gsa Oct 14, 2022
914cdfe
Review comment
jmax-gsa Oct 14, 2022
27e2024
Lint nit and spec helper fix
jmax-gsa Oct 14, 2022
b4d906c
Lint uglifying.
jmax-gsa Oct 14, 2022
32e16f7
Removed test for dead code.
jmax-gsa Oct 14, 2022
18155ef
Removed unused string
jmax-gsa Oct 14, 2022
85235ca
Update app/javascript/packs/personal-key-page-controller.js
jmax-gsa Oct 17, 2022
f79fa64
Review comments
jmax-gsa Oct 17, 2022
9badbce
Removed dead code.
jmax-gsa Oct 17, 2022
a48b000
Added event table entry for checkbox click
jmax-gsa Oct 17, 2022
b618cc0
Fixed event logging cleanup
jmax-gsa Oct 17, 2022
7ad022a
More event logging
jmax-gsa Oct 17, 2022
b58a667
Lint nit
jmax-gsa Oct 17, 2022
814e8b2
Event logging
jmax-gsa Oct 17, 2022
a83b2dc
Updated logging spec
jmax-gsa Oct 17, 2022
4369308
Typo
jmax-gsa Oct 17, 2022
bab446f
Text tweak.
jmax-gsa Oct 17, 2022
20936b8
Tweaked method name
jmax-gsa Oct 17, 2022
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
60 changes: 9 additions & 51 deletions app/javascript/packs/personal-key-page-controller.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import { encodeInput } from '@18f/identity-personal-key-input';
import { trackEvent } from '@18f/identity-analytics';
import { t } from '@18f/identity-i18n';

const modalSelector = '#personal-key-confirm';
const modal = new window.LoginGov.Modal({ el: modalSelector });

const personalKeyWords = [].slice.call(document.querySelectorAll('[data-personal-key]'));
const formEl = document.getElementById('confirm-key');
const input = formEl.querySelector('input[type="text"]');
const modalTrigger = document.querySelector('[data-toggle="modal"]');
const modalDismiss = document.querySelector('[data-dismiss="personal-key-confirm"]');
const downloadLink = document.querySelector('a[download]');
const acknowledgmentCheckbox = document.getElementById('acknowledgment');

function scrapePersonalKey() {
const keywords = [];
Expand All @@ -22,43 +14,6 @@ function scrapePersonalKey() {
return keywords.join('-').toUpperCase();
}

const personalKey = scrapePersonalKey();

function resetForm() {
formEl.reset();
input.setCustomValidity('');
}

function validateInput() {
let isValid = false;
try {
const value = encodeInput(input.value);
isValid = value === personalKey;
} catch {}

input.setCustomValidity(isValid ? '' : t('users.personal_key.confirmation_error'));
}

function show(event) {
event.preventDefault();

modal.on('show', function () {
input.focus();
});

trackEvent('IdV: show personal key modal');
modal.show();
}

function hide() {
modal.on('hide', function () {
resetForm();
});

trackEvent('IdV: hide personal key modal');
modal.hide();
}

function downloadForIE(event) {
event.preventDefault();

Expand All @@ -69,16 +24,19 @@ function downloadForIE(event) {
window.navigator.msSaveBlob(blob, filename);
}

function trackAcknowledgment(clickEvent) {
trackEvent(
'IdV: personal key acknowledgment toggled',
{ checked: clickEvent.target.checked },
);
}

function trackDownload() {
trackEvent('IdV: download personal key');
}

if (modalTrigger) {
modalTrigger.addEventListener('click', show);
}
modalDismiss.addEventListener('click', hide);
input.addEventListener('input', validateInput);
downloadLink.addEventListener('click', trackDownload);
acknowledgmentCheckbox.addEventListener('click', trackAcknowledgment);

if (window.navigator.msSaveBlob) {
downloadLink.addEventListener('click', downloadForIE);
Expand Down
32 changes: 28 additions & 4 deletions app/views/partials/personal_key/_key.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,42 @@
<div class="border-y border-primary-light bg-primary-lightest padding-y-3 text-center">
<h2 class="margin-y-0">
<%= t('users.personal_key.header') %>
</h2>
<div class="bg-personal-key padding-top-4 margin-y-2">
<div class="personal-key-block">
<% code.split('-').each do |word| %>
<% concat(content_tag(:strong, word, class: 'personal-key-block__code', data: { personal_key: '' })) %>
<% end %>
</div>
</div>
<p class="margin-y-0">
<p class="margin-bottom-105">
<%= t(
'users.personal_key.generated_on_html',
date: content_tag(:strong, I18n.l(Time.zone.today, format: '%B %d, %Y')),
) %>
</p>

<%= render ClipboardButtonComponent.new(
clipboard_text: code,
unstyled: true,
) %>

<%= render ButtonComponent.new(
action: ->(**tag_options, &block) do
link_to(
"data:text/plain;charset=utf-8,#{CGI.escape(code)}",
download: 'personal_key.txt',
**tag_options,
&block
)
end,
icon: :file_download,
unstyled: true,
class: 'margin-x-2 display-inline-block',
).with_content(t('forms.backup_code.download')) %>

<%= render PrintButtonComponent.new(
icon: :print,
unstyled: true,
type: :button,
class: 'margin-right-2 margin-bottom-2 tablet:margin-bottom-0',
) %>

</div>
85 changes: 40 additions & 45 deletions app/views/shared/_personal_key.html.erb
Original file line number Diff line number Diff line change
@@ -1,51 +1,46 @@
<%= render PageHeadingComponent.new.with_content(t('headings.personal_key')) %>
<p>
<%= t('instructions.personal_key.info') %>
</p>
<%= render PageHeadingComponent.new.with_content(t('forms.personal_key_partial.header')) %>
<div class="full-width-box margin-y-5">
<%= render 'partials/personal_key/key', code: code %>
</div>
<%= render ButtonComponent.new(
action: ->(**tag_options, &block) do
link_to(
"data:text/plain;charset=utf-8,#{CGI.escape(code)}",
download: 'personal_key.txt',
**tag_options,
&block
)
end,
icon: :file_download,
outline: true,
class: 'margin-right-2 margin-bottom-2 tablet:margin-bottom-0',
).with_content(t('forms.backup_code.download')) %>
<%= render PrintButtonComponent.new(
icon: :print,
outline: true,
type: :button,
class: 'margin-right-2 margin-bottom-2 tablet:margin-bottom-0',
) %>
<%= render ClipboardButtonComponent.new(
clipboard_text: code,
outline: true,
class: 'margin-bottom-2 tablet:margin-bottom-0',
) %>
<div class="margin-y-5 clearfix">
<%= image_tag(
asset_url('alert/icon-lock-alert-important.svg'),
alt: '',
size: '80',
class: 'float-left margin-right-2',

<%= render AccordionComponent.new do |c| %>
<% c.header { t('forms.personal_key_partial.explanation.header') } %>
<% t('forms.personal_key_partial.explanation.text').each do |paragraph| %>
<p><%= paragraph %></p>
<% end %>
<% end %>

<%= simple_form_for('', url: update_path) do |f| %>
<% @acceptance_prompt = capture do %>
<p>
<strong>
<%= t('forms.personal_key_partial.acknowledgement.header') %>
</strong>
</p>
<p class="margin-bottom-0">
<%= t('forms.personal_key_partial.acknowledgement.text') %>
</p>
<ul>
<% t('forms.personal_key_partial.acknowledgement.bullets').each do |bullet| %>
<li><%= bullet %></li>
<% end %>
</ul>
<p>
<%= t('forms.personal_key_partial.acknowledgement.instructions') %>
</p>
<% end %>

<%= render ValidatedFieldComponent.new(
form: f,
name: :acknowledgment,
as: :boolean,
label: @acceptance_prompt,
Comment thread
jmax-gsa marked this conversation as resolved.
Outdated
label_html: { class: 'margin-y-0' },
required: true,
) %>
<p class="margin-bottom-0">
<strong><%= t('instructions.personal_key.email_title') %></strong>
</p>
<p><%= t('instructions.personal_key.email_body') %></p>
</div>
<%= button_to(
t('forms.buttons.continue'),
update_path,
class: 'display-block usa-button usa-button--big usa-button--wide personal-key-continue margin-top-5',
'data-toggle': FeatureManagement.idv_personal_key_confirmation_enabled? ? 'modal' : 'skip',
Comment thread
jmax-gsa marked this conversation as resolved.
) %>

<%= f.submit(t('forms.buttons.continue'), full_width: true, class: 'margin-top-3') %>
<% end %>

<%= render 'shared/personal_key_confirmation_modal', code: code, update_path: update_path %>
Comment thread
jmax-gsa marked this conversation as resolved.
<%== javascript_packs_tag_once 'personal-key-page-controller' %>
2 changes: 1 addition & 1 deletion config/locales/components/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ es:
phone_input:
country_code_label: Código del país
print_button:
label: Imprima esta página
label: Imprima
troubleshooting_options:
default_heading: '¿Tiene alguna dificultad? Esto es lo que puede hacer:'
new_feature: Nueva función
2 changes: 1 addition & 1 deletion config/locales/components/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fr:
phone_input:
country_code_label: Code pays
print_button:
label: Imprimer cette page
label: Imprimer
troubleshooting_options:
default_heading: 'Des difficultés? Voici ce que vous pouvez faire:'
new_feature: Nouvelle fonction
20 changes: 19 additions & 1 deletion config/locales/forms/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ en:
caution_delete: If you delete your backup codes you will no longer be able to
use them to sign in.
confirm_delete: Are you sure you want to delete your backup codes?
download: Download
download: Download (text file)
Comment thread
jmax-gsa marked this conversation as resolved.
Outdated
generate: Get codes
last_code: You used your last backup code. Please print, copy or download the
codes below. You can use these new codes the next time you sign in.
Expand Down Expand Up @@ -68,6 +68,24 @@ en:
confirmation_label: Personal key
instructions: Please confirm you have a copy of your personal key by entering it below.
title: Enter your personal key
personal_key_partial:
acknowledgement:
bullets:
- You’ll lose access to your account
- You’ll need to verify your identity again
header: You need your personal key if you forget your password. Keep it safe and
don’t share it with anyone.
instructions: Check the box above to continue
text: 'If you reset your password without your personal key:'
explanation:
header: What is a personal key?
text:
- A personal key “locks” your personal information with your account.
It’s the only way to unlock your information if you lose or forget
your password.
- When you reset your password, Login.gov will ask for your personal
key to make sure you are you - not someone pretending to be you.
header: Save your personal key
phone:
buttons:
delete: Remove phone
Expand Down
21 changes: 20 additions & 1 deletion config/locales/forms/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ es:
caution_delete: Si elimina sus códigos de respaldo, ya no podrá usarlos para
iniciar sesión.
confirm_delete: '¿Estás seguro de que deseas eliminar tus códigos de respaldo?'
download: Descargar
download: Descargar (archivo de texto)
generate: Obtener códigos
last_code: Usted utilizó el último código de seguridad. Imprima, copie o
descargue los códigos que aparecen a continuación. Puede introducir
Expand Down Expand Up @@ -74,6 +74,25 @@ es:
instructions: Confirme que tiene una copia de su clave personal ingresándola a
continuación.
title: Ingrese su clave personal
personal_key_partial:
acknowledgement:
bullets:
- Perderás el acceso a tu cuenta
- Tendrás que verificar tu identidad nuevamente
header: Necesitarás tu clave personal si olvidas tu contraseña. Mantenla en un
lugar seguro y no la compartas con nadie.
instructions: Marca la casilla de arriba para continuar.
text: 'Si restableces tu contraseña sin tu clave personal:'
explanation:
header: ¿Qué es una clave personal?
text:
- Una clave personal “bloquea” la información personal de tu cuenta.
Es la única manera de desbloquear tu información si pierdes u
olvidas tu contraseña.
- Si restableces tu contraseña, Login.gov te pedirá tu clave personal
para asegurarse de que se trata de ti, y no de alguien que quiere
hacerse pasar por ti.
header: Guarda tu clave personal
phone:
buttons:
delete: Eliminar el teléfono
Expand Down
21 changes: 20 additions & 1 deletion config/locales/forms/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fr:
caution_delete: Si vous supprimez vos codes de sauvegarde, vous ne pourrez plus
les utiliser pour vous connecter.
confirm_delete: Êtes-vous sûr de vouloir supprimer vos codes de sauvegarde?
download: Télécharger
download: Télécharger (fichier texte)
generate: Obtenir des codes
last_code: Vous avez utilisé votre dernier code de sauvegarde. Veuillez
imprimer, copier ou télécharger les codes ci-dessous. Vous pourrez
Expand Down Expand Up @@ -75,6 +75,25 @@ fr:
instructions: Veuillez confirmer que vous avez une copie de votre clé
personnelle en l’entrant ci-dessous.
title: Entrez votre clé personnelle
personal_key_partial:
acknowledgement:
bullets:
- Vous perdrez l’accès à votre compte
- Vous allez devoir vérifier à nouveau votre identité
header: En cas d’oubli de votre mot de passe, vous aurez besoin de votre clé
personnelle. Gardez-la en sécurité et ne la partagez avec personne.
instructions: Cochez la case ci-dessus pour continuer.
text: 'Si vous réinitialisez votre mot de passe sans votre clé personnelle:'
explanation:
header: Qu’est-ce qu’une clé personnelle?
text:
- Une clé personnelle « verrouille » vos informations personnelles
avec votre compte. C’est le seul moyen de déverrouiller vos
informations si vous perdez ou oubliez votre mot de passe.
- Lors de la réinitialisation de votre mot de passe, Login.gov vous
demandera votre clé personnelle pour s’assurer que vous êtes bien
vous, et non quelqu’un qui se fait passer pour vous.
header: Sauvegardez votre clé personnelle
phone:
buttons:
delete: Supprimer le numéro de teléfono
Expand Down
1 change: 0 additions & 1 deletion config/locales/headings/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ en:
confirm: Confirm your current password to continue
confirm_for_personal_key: Enter password and get a new personal key
forgot: Forgot your password?
personal_key: Save your personal key
piv_cac:
certificate:
bad: The PIV/CAC certificate you selected is invalid
Expand Down
1 change: 0 additions & 1 deletion config/locales/headings/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ es:
confirm: Confirme la contraseña actual para continuar
confirm_for_personal_key: Introduzca la contraseña y obtenga una nueva clave personal
forgot: '¿Olvidó su contraseña?'
personal_key: Guarda tu clave personal
piv_cac:
certificate:
bad: El certificado PIV/CAC que seleccionaste no es válido.
Expand Down
1 change: 0 additions & 1 deletion config/locales/headings/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ fr:
confirm: Confirmez votre mot de passe actuel pour continuer
confirm_for_personal_key: Entrez le mot de passe et obtenez une nouvelle clé personnelle
forgot: Vous avez oublié votre mot de passe?
personal_key: Enregistrez votre clé personnelle
piv_cac:
certificate:
bad: Le certificat PIV/CAC que vous avez sélectionné n’est pas valide.
Expand Down
7 changes: 0 additions & 7 deletions config/locales/instructions/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,6 @@ en:
intro: 'Password strength: '
iv: Good
v: Great!
personal_key:
email_body: Don’t lose your personal key or share it with others. We’ll ask for
it if you reset your password.
email_title: Save it. Keep it safe.
info: You’ll need this personal key if you forget your password. If you reset
your password and don’t have this key, you’ll have to verify your
identity again.
sp_handoff_bounced: Your sign in was successful, but %{sp_name} sent you back to
%{app_name}. Please contact %{sp_link} for help.
sp_handoff_bounced_with_no_sp: your service provider
7 changes: 0 additions & 7 deletions config/locales/instructions/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,6 @@ es:
intro: 'Seguridad de la contraseña:'
iv: Buena
v: '¡Muy buena!'
personal_key:
email_body: No pierdas tu clave personal ni la compartas con otros. La pediremos
si restableces tu contraseña.
email_title: Guárdala. Manténla segura.
info: Necesitarás esta clave personal si olvidas tu contraseña. Si restableces
tu contraseña y no tienes esta clave, deberás verificar tu identidad
nuevamente.
sp_handoff_bounced: Su inicio de sesión fue exitoso, pero %{sp_name} lo envió de
regreso a %{app_name}. Póngase en contacto con %{sp_link} para obtener
ayuda.
Expand Down
Loading