fix password reset with bad password scenario

This commit is contained in:
simon lehericey 2024-07-31 21:18:23 +02:00 committed by Kara Diaby
parent eaef5c7e39
commit ce095479b7
No known key found for this signature in database
GPG key ID: C4D1B0CF9F24D759
7 changed files with 8 additions and 34 deletions

View file

@ -1,16 +1,7 @@
%p
= t('.already_exists', email: email, application_name: Current.application_name)
%br
= t('.fill_in_password')
= form_tag france_connect_particulier_merge_using_password_path, data: { turbo: true }, class: 'mt-2 form fconnect-form', id: 'merge_using_password' do
= hidden_field_tag :merge_token, fci.merge_token, id: dom_id(fci, :fusion_merge_token)
.fr-input-group{ class: class_names('fr-input-group--error': wrong_password) }
= label_tag :password, t('views.registrations.new.password_label', min_length: 8), class: 'fr-label'
= password_field_tag :password, nil, autocomplete: 'current-password', class: 'mb-1 fr-input'
= form_tag france_connect_particulier_merge_with_existing_account_path, data: { turbo: true, turbo_force: :server }, class: 'mt-2 form fconnect-form' do
= hidden_field_tag :merge_token, merge_token
= hidden_field_tag :email, email
= label_tag :password, t('views.registrations.new.password_label', min_length: 8)
= password_field_tag :password, nil, autocomplete: 'current-password', id: 'password-for-another-account'
.mb-2
= t('views.users.sessions.new.reset_password')
= link_to france_connect_particulier_send_email_merge_path(merge_token: merge_token), method: :post do
= t('france_connect.particulier.merge.link_confirm_by_email')
= button_tag t('.back'), type: 'button', class: 'button secondary', onclick: 'DS.showNewAccount(event);'
= submit_tag t('france_connect.particulier.merge.button_merge'), class: 'button primary'
= submit_tag t('france_connect.particulier.merge.button_merge'), class: 'fr-btn'

View file

@ -20,13 +20,7 @@
.fusion.hidden
%p= t('.title_fill_in_password')
= form_tag france_connect_particulier_merge_using_password_path, data: { turbo: true }, class: 'mt-2 form fconnect-form' do
= hidden_field_tag :merge_token, @fci.merge_token, id: dom_id(@fci, :fusion_merge_token)
.fr-input-group
= label_tag :password, t('views.registrations.new.password_label', min_length: 8), class: 'fr-label'
= password_field_tag :password, nil, autocomplete: 'current-password', class: 'mb-1 fr-input'
= submit_tag t('.button_merge'), class: 'fr-btn'
= render partial: 'password_confirmation', locals: { fci: @fci, wrong_password: @wrong_password }
.mt-2
= button_to t('.link_confirm_by_email'),

View file

@ -0,0 +1 @@
= turbo_stream.replace('merge_using_password', partial: 'password_confirmation', locals: { fci: @fci, wrong_password: true })

View file

@ -1,4 +0,0 @@
= turbo_stream.update 'new-account-password-confirmation', partial: 'password_confirmation', locals: { email: @email, merge_token: @merge_token }
= turbo_stream.hide_all '.fusion'
= turbo_stream.hide_all '.new-account'
= turbo_stream.show 'new-account-password-confirmation'

View file

@ -897,10 +897,6 @@ en:
intro: "A confirmation email has been sent to your address %{email}"
click_the_link_in_the_email: "Please click the link in the email to confirm your account and connect with France Connect in the future."
continue: "Continue"
password_confirmation:
back: 'back to previous step'
already_exists: An account with %{email} already existis on %{application_name}
fill_in_password: fill in your password to merge your accounts
merge:
title: "Merge your account FranceConnect and %{application_name}"
subtitle_html: "Hello,<br /><br />Your account FranceConnect uses <b class='bold'>%{email}</b> as contact email.<br />But there is an existing %{application_name} account using this email."

View file

@ -952,10 +952,6 @@ fr:
intro: Un mail de confirmation a été envoyé à votre adresse %{email}
click_the_link_in_the_email: Vous devez impérativement cliquer sur le lien du mail pour activer votre adresse et recevoir les notifications sur l'avancement de vos dossiers.
continue: Continuer
password_confirmation:
back: 'revenir en arrière'
already_exists: Le compte %{email} existe déjà sur %{application_name}
fill_in_password: entrez votre mot de passe pour fusionner les comptes
merge:
title: "Fusion des comptes FranceConnect et %{application_name}"
subtitle_html: "Bonjour,<br /><br />Votre compte FranceConnect utilise <b class='bold'>%{email}</b> comme email de contact.<br />Or il existe un compte sur %{application_name} avec cet email."