Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineGirard committed Dec 5, 2024
1 parent 8c6a26c commit 7b4a193
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
.fr-grid-row.fr-grid-row--gutters
.fr-col-md-6= f.dsfr_text_field :first_name, required: true
.fr-col-md-6= f.dsfr_text_field :last_name, required: true
= render "common/form/new_password_input", f: f, live_validation: true, hint: "Choisissez votre mot de passe"
= render "common/form/new_password_input", f: , hint: "Choisissez votre mot de passe"

.fr-btns-group.fr-btns-group--inline.fr-btns-group--right
.fr-mt-2w= f.submit t("devise.invitations.edit.submit_button"), class: "fr-btn"
13 changes: 8 additions & 5 deletions app/views/common/form/_current_password_input.html.slim
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
- attribute_name = defined?(name) ? name : :password
= f.dsfr_input_group attribute_name, class: "fr-password fr-mt-2w"
= f.dsfr_label_with_hint attribute_name, class: "fr-label", for: "password", hint: defined?(hint) ? hint : nil, label: defined?(password_label) ? password_label : nil
/# locals: (f:, name: :password, hint: nil, password_label: nil, forgotten_password_link: false)
= f.dsfr_input_group name, class: "fr-password fr-mt-2w"
= f.dsfr_label_with_hint name, class: "fr-label", for: "password", hint: hint, label: password_label
.fr-input-wrap
= f.password_field attribute_name, autocomplete: "current-password", required: true, class: "fr-password__input fr-input"
= f.dsfr_error_message attribute_name
= f.password_field name, autocomplete: "current-password", required: true, class: "fr-password__input fr-input"
= f.dsfr_error_message name
.fr-password__checkbox.fr-checkbox-group.fr-checkbox-group--sm
input type="checkbox" aria-label="Afficher le mot de passe" id="password-show"
label for="password-show" class="fr-password__checkbox fr-label" Afficher
- if forgotten_password_link
= link_to "Mot de passe oublié ?", new_password_path(resource_name), class: "fr-link"
7 changes: 4 additions & 3 deletions app/views/common/form/_new_password_input.html.slim
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/# 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_label_with_hint :password, class: "fr-label fr-password__label", hint: defined?(hint) ? hint : nil, label: defined?(password_label) ? password_label : nil
= f.dsfr_label_with_hint :password, class: "fr-label fr-password__label", hint: hint, label: password_label
.fr-input-wrap
= 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
input#new-password-show[class="fr-checkbox" aria-label="Afficher le mot de passe" type="checkbox"]
label.fr-password__checkbox.fr-label[for = "new-password-show"] Afficher
- if defined?(live_validation) && live_validation
= render "common/form/password_live_validation"
= render "common/form/password_live_validation"
2 changes: 1 addition & 1 deletion app/views/users/passwords/edit.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
= 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
= render "common/form/new_password_input", f: f, live_validation: true
= render "common/form/new_password_input", f: f

.rdv-text-align-center
= f.submit "Enregistrer", class: "fr-btn"
2 changes: 1 addition & 1 deletion app/views/users/registrations/edit.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- if devise_mapping.confirmable? && resource.pending_reconfirmation?
.form-text.rdv-color-text-mention-grey.mb-2
| En attente de confirmation pour #{resource.unconfirmed_email}
= render "common/form/new_password_input", f: f, live_validation: true, hint: "Choisissez votre mot de passe ou laissez ce champ vide si vous ne souhaitez pas changer votre mot de passe.", password_label: "Nouveau mot de passe"
= render "common/form/new_password_input", f:, hint: "Choisissez votre mot de passe ou laissez ce champ vide si vous ne souhaitez pas changer votre mot de passe.", password_label: "Nouveau mot de passe"
= render "common/form/current_password_input", f: f, name: :current_password, hint: "Renseignez votre mot de passe actuel pour tout changement.", password_label: "Mot de passe actuel"
.rdv-text-align-right= f.submit "Modifier", class: "fr-btn"
.mt-5.rdv-text-align-center
Expand Down
18 changes: 3 additions & 15 deletions app/views/users/sessions/new.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,10 @@

h2 Se connecter avec son compte

= form_for resource, as: resource_name, url: session_path(resource_name) do |f|
= form_for resource, as: resource_name, url: session_path(resource_name), builder: DsfrFormBuilder do |f|
= render "devise/shared/error_messages", resource: resource
.fr-input-group
= f.label :email, class: "fr-label" do
= "Adresse email"
span.fr-hint-text Format attendu : [email protected]
= f.email_field :email, autofocus: true, class: "fr-input"
.fr-password
= f.label :password, class: "fr-label", for: "password"
.fr-input-wrap
= f.password_field :password, autocomplete: "current-password", required: true, class: "fr-password__input fr-input", id: "password"
.fr-password__checkbox.fr-checkbox-group.fr-checkbox-group--sm
input type="checkbox" aria-label="Afficher le mot de passe" id="password-show"
label for="password-show" class="fr-password__checkbox fr-label" Afficher

= link_to "Mot de passe oublié ?", new_password_path(resource_name), class: "fr-link"
= f.dsfr_email_field :email, autofocus: true, hint: "Format attendu : [email protected]", require: true, label: "Adresse email"
= render "common/form/current_password_input", f:, forgotten_password_link: true

.rdv-text-align-center
= f.submit "Se connecter", class: "fr-mt-2v fr-btn"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
expect(page).to have_content("Vous devez vous connecter ou vous inscrire pour continuer")

fill_in("user_email", with: user.email)
fill_in("password", with: user.password)
fill_in("user_password", with: user.password)
click_button("Se connecter")
expect(page).to have_current_path("/users/rdvs")
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/users/account/user_session_expires_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def expect_to_be_logged_out
it "is done 30 minutes after last visit" do
visit new_user_session_path
fill_in "Adresse email", with: user.email
fill_in "password", with: password
fill_in "user_password", with: password
within("main") { click_on "Se connecter" }
expect_to_be_logged_in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
click_link "Se connecter"
within("form") do
fill_in :user_email, with: agent.email
fill_in :password, with: agent.password
fill_in :user_password, with: agent.password
click_on "Se connecter"
end
expect(page).to have_current_path(admin_organisation_agent_agenda_path(agent.organisations.first, agent), ignore_query: true)
Expand All @@ -91,8 +91,8 @@

it "shows a warning and advises to change the password" do
visit new_user_session_path
fill_in "Adresse email", with: agent.email
fill_in "password", with: "tropfaible"
fill_in :user_email, with: agent.email
fill_in :user_password, with: "tropfaible"
within("main") { click_on "Se connecter" }
expect(page).to have_content("Votre mot de passe est trop faible")
end
Expand Down
18 changes: 9 additions & 9 deletions spec/features/users/online_booking/on_rdv_mairie_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def json_response
public_link_organisation_id: organisation.id, duration: 50))

fill_in("user_email", with: user.email)
fill_in("password", with: user.password)
fill_in("user_password", with: user.password)
click_button("Se connecter")

expect(page).to have_field("Numéro de pré-demande ANTS")
Expand Down Expand Up @@ -126,7 +126,7 @@ def json_response
visit creneaux_url

fill_in("user_email", with: user.email)
fill_in("password", with: user.password)
fill_in("user_password", with: user.password)
click_button("Se connecter")

fill_in("user_ants_pre_demande_number", with: "1122334455")
Expand Down Expand Up @@ -163,7 +163,7 @@ def json_response
visit creneaux_url

fill_in("user_email", with: user.email)
fill_in("password", with: user.password)
fill_in("user_password", with: user.password)
click_button("Se connecter")

fill_in("user_ants_pre_demande_number", with: "1234ABC")
Expand All @@ -181,7 +181,7 @@ def json_response
visit creneaux_url

fill_in("user_email", with: user.email)
fill_in("password", with: user.password)
fill_in("user_password", with: user.password)
click_button("Se connecter")

fill_in("user_ants_pre_demande_number", with: "abcd1234ef")
Expand All @@ -200,7 +200,7 @@ def json_response
visit creneaux_url

fill_in("user_email", with: user.email)
fill_in("password", with: user.password)
fill_in("user_password", with: user.password)
click_button("Se connecter")

fill_in("user_ants_pre_demande_number", with: " ")
Expand All @@ -223,7 +223,7 @@ def json_response
visit creneaux_url

fill_in("user_email", with: user.email)
fill_in("password", with: user.password)
fill_in("user_password", with: user.password)
click_button("Se connecter")

fill_in("user_ants_pre_demande_number", with: "5544332211")
Expand All @@ -243,7 +243,7 @@ def json_response
expect(page).to have_content("Motif : Passeport")

fill_in("user_email", with: user.email)
fill_in("password", with: user.password)
fill_in("user_password", with: user.password)
click_button("Se connecter")

expect(page).to have_field("Numéro de pré-demande ANTS")
Expand All @@ -266,7 +266,7 @@ def json_response
expect(page).to have_content("Motif : Retrait")

fill_in("user_email", with: user.email)
fill_in("password", with: user.password)
fill_in("user_password", with: user.password)
click_button("Se connecter")

expect(page).not_to have_field("Numéro de pré-demande ANTS")
Expand All @@ -285,7 +285,7 @@ def json_response
expect(page).to have_content("Motif : Retrait")

fill_in("user_email", with: user.email)
fill_in("password", with: user.password)
fill_in("user_password", with: user.password)
click_button("Se connecter")

expect(page).not_to have_field("Numéro de pré-demande ANTS")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def json_response
expect(page).to have_content("Vous devez vous connecter ou vous inscrire pour continuer")

fill_in("user_email", with: user.email)
fill_in("password", with: user.password)
fill_in("user_password", with: user.password)
click_button("Se connecter")

expect(page).not_to have_field("Numéro de pré-demande ANTS")
Expand Down
2 changes: 1 addition & 1 deletion spec/features/users/user_can_manage_collective_rdv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def expect_webhooks_for(user)

expect(page).to have_content("Vous devez vous connecter ou vous inscrire pour continuer.")
fill_in("user_email", with: logged_user.email)
fill_in("password", with: logged_user.password)
fill_in("user_password", with: logged_user.password)

click_button("Se connecter")
click_button("Continuer")
Expand Down

0 comments on commit 7b4a193

Please sign in to comment.