From 5edd54b59898168a4fe1b24305c806da3666781b Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Fri, 22 Nov 2024 15:19:47 +0100 Subject: [PATCH] fix: verified_email from FC --- .../france_connect/particulier_controller.rb | 5 ++--- .../particulier/confirmation_sent.html.haml | 12 ------------ config/locales/en.yml | 5 ----- config/locales/fr.yml | 5 ----- .../france_connect/particulier_controller_spec.rb | 5 ++--- 5 files changed, 4 insertions(+), 28 deletions(-) delete mode 100644 app/views/france_connect/particulier/confirmation_sent.html.haml diff --git a/app/controllers/france_connect/particulier_controller.rb b/app/controllers/france_connect/particulier_controller.rb index e0a7740de..0fef3bd65 100644 --- a/app/controllers/france_connect/particulier_controller.rb +++ b/app/controllers/france_connect/particulier_controller.rb @@ -59,12 +59,11 @@ class FranceConnect::ParticulierController < ApplicationController def merge_using_fc_email @fci.safely_associate_user!(@fci.email_france_connect) + @fci.user.update!(email_verified_at: Time.current) sign_in(@fci.user) - @fci.send_custom_confirmation_instructions - - render :confirmation_sent, locals: { email: @fci.email_france_connect, destination_path: destination_path(@fci.user) } + redirect_to destination_path(@fci.user), notice: t('france_connect.particulier.flash.connection_done', application_name: Current.application_name) end def merge_using_password diff --git a/app/views/france_connect/particulier/confirmation_sent.html.haml b/app/views/france_connect/particulier/confirmation_sent.html.haml deleted file mode 100644 index 98ca08acc..000000000 --- a/app/views/france_connect/particulier/confirmation_sent.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -.fr-container - .fr-col-12.fr-col-md-6.fr-col-offset-md-3 - %h1.fr-mt-6w.fr-h2.center= t('.confirmation_sent_by_email') - - %p.center= image_tag("user/confirmation-email.svg", alt: '') - - = render Dsfr::AlertComponent.new(title: '', state: :info, heading_level: 'h2', extra_class_names: 'fr-mt-6w fr-mb-3w') do |c| - - c.with_body do - %p= t('.intro_html', email: h(email)).html_safe - %p= t('.click_the_link_in_the_email') - - %p.center= link_to t('.continue'), destination_path, class: 'fr-btn' diff --git a/config/locales/en.yml b/config/locales/en.yml index 45765dfed..802577728 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -888,11 +888,6 @@ en: alternative_email: "Please provide the email to use for contacting you." keep_fc_email_html: Yes, use %{email} as contact email. use_another_email: No, use another address. - confirmation_sent: - confirmation_sent_by_email: "Confirm your email" - intro_html: "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" merge: title: "Merge your account FranceConnect and %{application_name}" subtitle_html: "Hello,

Your account FranceConnect uses %{email} as contact email.
But there is an existing %{application_name} account using this email." diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 8ee69b8c3..40a068d49 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -942,11 +942,6 @@ fr: use_another_email: Non, utiliser une autre adresse email_suggest: wanna_say: 'Voulez-vous dire ?' - confirmation_sent: - confirmation_sent_by_email: Confirmez votre email - intro_html: "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 merge: title: "Fusion des comptes FranceConnect et %{application_name}" subtitle_html: "Bonjour,

Votre compte FranceConnect utilise %{email} comme email de contact.
Or il existe un compte sur %{application_name} avec cet email." diff --git a/spec/controllers/france_connect/particulier_controller_spec.rb b/spec/controllers/france_connect/particulier_controller_spec.rb index bdf717e27..8fdf24cad 100644 --- a/spec/controllers/france_connect/particulier_controller_spec.rb +++ b/spec/controllers/france_connect/particulier_controller_spec.rb @@ -155,10 +155,9 @@ describe FranceConnect::ParticulierController, type: :controller do user = User.last expect(user.email).to eq(email.downcase) - expect(UserMailer).to have_received(:custom_confirmation_instructions).with(user, user.confirmation_token) - expect(user.email_verified_at).to be_nil + expect(user.email_verified_at).not_to be_nil expect(fci.reload.merge_token).to be_nil - expect(response).to render_template(:confirmation_sent) + expect(response).to redirect_to(root_path(user)) end end