Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration invitation usager et reset password agent au DSFR #4926

Open
wants to merge 5 commits into
base: production
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
2 changes: 0 additions & 2 deletions app/javascript/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ require("@rails/ujs").start()
require("turbolinks").start()
import { PlacesInputs } from './components/places-inputs.js'
import { Modal } from './components/modal';
import { ShowHidePassword } from './components/show-hide-password.js';
import { NameInitialsForm } from './components/name-initials-form';
import DsfrNewPassword from "./components/dsfr-new-password";
import './components/browser-detection';
Expand All @@ -14,7 +13,6 @@ import './stylesheets/print';
new Modal();

$(document).on('turbolinks:load', function() {
new ShowHidePassword();
new PlacesInputs();
new NameInitialsForm();
DsfrNewPassword();
Expand Down
5 changes: 3 additions & 2 deletions app/javascript/application_agent_config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require("@rails/ujs").start()
require("turbolinks").start()
import { DsfrNewPassword } from "./components/dsfr-new-password";
import { Modal } from './components/modal';
import { ShowHidePassword } from './components/show-hide-password.js';
import './components/browser-detection';
import 'select2/dist/js/select2.min.js';
import 'select2/dist/js/i18n/fr.js';
Expand All @@ -16,6 +16,7 @@ new Modal();
new Select2Inputs();

$(document).on('turbolinks:load', function () {
new ShowHidePassword();
DsfrNewPassword();

new Clipboard();
});
15 changes: 0 additions & 15 deletions app/javascript/components/show-hide-password.js

This file was deleted.

9 changes: 0 additions & 9 deletions app/javascript/stylesheets/structure/_authentication.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@
}
}

.toggle-password {
float: right;
margin-right: 1rem;
margin-top: -1.8rem;
position: relative;
z-index: 2;
cursor: pointer;
}

.france-connect-link {
.hover {
display: none;
Expand Down
4 changes: 2 additions & 2 deletions app/views/common/form/_new_password_input.html.slim
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/# locals: (f:, hint: nil, password_label: nil)

= f.dsfr_input_group :password, class: "fr-password fr-mt-2w", data: {component: "js_dsfr_new_password"}
= f.dsfr_input_group :password, class: "fr-password", data: {component: "js_dsfr_new_password"}
= f.dsfr_label_with_hint :password, class: "fr-label fr-password__label", hint: hint, label: password_label
.fr-input-wrap
.fr-input-wrap.fr-mt-0
= f.password_field :password, class: "fr-input fr-password__input", required: "true", autocomplete: "new-password"
= f.dsfr_error_message :password
.fr-password__checkbox.fr-checkbox-group.fr-checkbox-group--sm
Expand Down
12 changes: 4 additions & 8 deletions app/views/devise/passwords/edit.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
- if @from_confirmation
p.text-muted Pour finaliser votre inscription, veuillez définir un mot de passe.

= simple_form_for resource, as: resource_name, url: password_path(resource_name), html: { method: :put } do |f|
= render "devise/shared/error_messages", resource: resource
= f.input :reset_password_token, as: :hidden
= form_for resource, as: resource_name, url: password_path(resource_name), html: { method: :put }, builder: DsfrFormBuilder do |f|
= f.hidden_field :reset_password_token
.form-group
= f.password_field :password, as: :password, label: "Mot de passe", class: "form-control", autocomplete: "new-password", required: true, id: "password"
span.fa.fa-fw.fa-eye.toggle-password role="button" tabindex="0"

= render "agents/mot_de_passes/new_password_hints"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plus qu’une utilisation de ce partial dans agents/mot_de_passes/edit.html.slim, on pourrait éventuellement l’y inliner mais ce n’est absolument pas bloquant, je le note juste au passage

= render "common/form/new_password_input", f: f

.text-center
= f.submit "Enregistrer", class: "btn btn btn-primary"
= f.submit "Enregistrer", class: "fr-btn"

- unless @from_confirmation
- content_for :footer do
Expand Down
10 changes: 4 additions & 6 deletions app/views/devise/passwords/new.html.slim
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
= form_for resource, as: resource_name, url: password_path(resource_name) do |f|
= form_for resource, as: resource_name, url: password_path(resource_name), builder: DsfrFormBuilder do |f|
.text-center.w-75.m-auto
h4.text-dark-50.text-center.mt-0.font-weight-bold Mot de passe oublié ?
p.text-muted.mb-4 Entrez votre email pour recevoir un lien de réinitialisation de mot de passe
= render "devise/shared/error_messages", resource: resource
.form-group
= f.email_field :email, autofocus: true, required: true, placeholder: "[email protected]", class: "form-control"
.form-group.mb-0.text-center
= f.submit "Envoyer", class: "btn btn btn-primary"
= f.dsfr_email_field :email, label: "Adresse email", hint: "Format attendu : [email protected]", required: true, autofocus: true
.text-center
= f.submit "Envoyer", class: "fr-btn"

- content_for :footer do
= render "devise/shared/links"
29 changes: 10 additions & 19 deletions app/views/users/invitations/edit.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,17 @@
= render "users/rdv_wizard_steps/rdv_wizard_summary", rdv_wizard: @rdv_wizard if @rdv_wizard.present?

.card-body
= simple_form_for resource, as: resource_name, url: invitation_path(resource_name), html: { method: :put } do |f|
= form_for resource, as: resource_name, url: invitation_path(resource_name), html: { method: :put }, builder: DsfrFormBuilder do |f|
.rdv-text-align-center.w-75.m-auto
= render "devise/shared/error_messages", resource: resource
= render "devise/shared/dsfr_error_messages", resource: resource
= f.hidden_field :invitation_token
.form-row
.col-md-6= f.input :first_name, placeholder: "Prénom"
.col-md-6= f.input :last_name, placeholder: "Nom"
.form-row
.fr-grid-row.fr-grid-row--gutters
.fr-col-md-6= f.dsfr_text_field :first_name, label: "Prénom"
.fr-col-md-6= f.dsfr_text_field :last_name, label: "Nom"
- if resource.email.present?
.col-md-12= f.input :email, value: resource.email, disabled: true
.fr-col-md-12= f.dsfr_email_field :email, value: resource.email, disabled: true
- else
.col-md-12= f.input :email, required: true
.form-row
.col-md-12= f.input :phone_number, as: :tel
.form-group
= f.label :password
= f.password_field :password, required: true, class: "form-control", id: "password", autocomplete: "new-password"
span.fa.fa-fw.fa-eye.toggle-password role="button" tabindex="0"
.form-text.small.rdv-color-text-mention-grey.mb-2
| Choisissez votre mot de passe

= render "agents/mot_de_passes/new_password_hints"
.rdv-text-align-center= f.button :submit, t("devise.invitations.edit.submit_button")
.fr-col-md-12= f.dsfr_email_field :email, required: true
.fr-col-md-12= f.dsfr_phone_field :phone_number, hint: "Saisissez un numéro à 10 chiffres de France métropole ou d’outre-mer, ou bien un numéro international avec le préfixe du pays."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je dis vive l’inlining 👍 est-ce que tu penses que la clé i18n simple_form.hints.user.phone_number est encore utilisée ? sinon je vote pour la supprimer au passage

.fr-col-md-12 = render "common/form/new_password_input", f: f
.rdv-text-align-center= f.submit "Enregistrer", class: "fr-btn"
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
current_email.click_link("Changer")
expect(page).to have_content("Définir mon mot de passe")

fill_in "password", with: "q1w2e3r4t5y6"
fill_in "Mot de passe", with: "q1w2e3r4t5y6"
expect { click_on "Enregistrer" }.not_to change { agent.reload.encrypted_password }
expect(page).to have_content("Ce mot de passe fait partie d'une liste de mots de passe fréquemment utilisés")

fill_in "password", with: "correct H0rse battery! staple"
fill_in "Mot de passe", with: "correct H0rse battery! staple"
expect { click_on "Enregistrer" }.to change { agent.reload.encrypted_password }
expect(page).to have_content("Votre mot de passe a été édité avec succès")
expect(page).to have_link("Vos organisations")
Expand All @@ -36,7 +36,7 @@
open_email(agent.email)
current_email.click_link("Changer")
expect(page).to have_content("Définir mon mot de passe")
fill_in "password", with: "correct H0rse battery! staple"
fill_in "Mot de passe", with: "correct H0rse battery! staple"
expect { click_on "Enregistrer" }.to change { agent.reload.encrypted_password }
expect(page).to have_content("Votre mot de passe a été édité avec succès")
expect(page).to have_link("Vos organisations")
Expand Down
Loading