From c4f2e6cab0d00ed87d21babcc7e988bcad142d6e Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 31 Mar 2020 16:58:36 +0200 Subject: [PATCH] credentials: add autocomplete attributes Allow browsers to autofill more informations. References: - MDN: Autofill (https://developer.mozilla.org/fr/docs/Web/HTML/Attributs/autocomplete) - Safari Password Autofill (https://developer.apple.com/documentation/security/password_autofill/enabling_password_autofill_on_an_html_input_element) --- app/views/users/dossiers/identite.html.haml | 4 ++-- app/views/users/registrations/new.html.haml | 4 ++-- app/views/users/sessions/new.html.haml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/users/dossiers/identite.html.haml b/app/views/users/dossiers/identite.html.haml index 1e65a5123..6e5d4cc16 100644 --- a/app/views/users/dossiers/identite.html.haml +++ b/app/views/users/dossiers/identite.html.haml @@ -26,10 +26,10 @@ .flex .inline-champ = f.label :prenom, class: "required" - = f.text_field :prenom, class: "small", required: true + = f.text_field :prenom, class: "small", required: true, autocomplete: 'given-name' .inline-champ = f.label :nom, class: "required" - = f.text_field :nom, class: "small", required: true + = f.text_field :nom, class: "small", required: true, autocomplete: 'family-name' - if @dossier.procedure.ask_birthday? = f.label :birthdate, class: "required" diff --git a/app/views/users/registrations/new.html.haml b/app/views/users/registrations/new.html.haml index e6602c9b5..356afb8d9 100644 --- a/app/views/users/registrations/new.html.haml +++ b/app/views/users/registrations/new.html.haml @@ -6,7 +6,7 @@ %h1 Créez-vous un compte demarches-simplifiees.fr = f.label :email, "Email" - = f.text_field :email, autofocus: true, placeholder: "Votre adresse email" + = f.text_field :email, type: :email, autocomplete: 'username', autofocus: true, placeholder: "Votre adresse email" .suspect-email.hidden .email-suggestion-title @@ -20,7 +20,7 @@ Non = f.label :password, "Mot de passe" - = f.password_field :password, value: @user.password, placeholder: "8 caractères minimum", 'aria-describedby':'8 caractères minimum' + = f.password_field :password, autocomplete: 'new-password', value: @user.password, placeholder: "8 caractères minimum", 'aria-describedby':'8 caractères minimum' = f.submit "Créer un compte", class: "button large primary expand" diff --git a/app/views/users/sessions/new.html.haml b/app/views/users/sessions/new.html.haml index ecb783bfe..992008b30 100644 --- a/app/views/users/sessions/new.html.haml +++ b/app/views/users/sessions/new.html.haml @@ -6,10 +6,10 @@ %h2.huge-title Connectez-vous = f.label :email, "Email" - = f.text_field :email, autofocus: true + = f.text_field :email, type: :email, autocomplete: 'username', autofocus: true = f.label :password, "Mot de passe" - = f.password_field :password + = f.password_field :password, autocomplete: 'current-password' .auth-options %div