use email_merge_token in mailer

This commit is contained in:
simon lehericey 2024-01-11 11:31:36 +01:00
parent fca28a3ebd
commit ca08b80c3e
3 changed files with 8 additions and 7 deletions

View file

@ -20,9 +20,9 @@ class UserMailer < ApplicationMailer
mail(to: requested_email, subject: @subject)
end
def france_connect_merge_confirmation(email, merge_token, merge_token_created_at)
@merge_token = merge_token
@merge_token_created_at = merge_token_created_at
def france_connect_merge_confirmation(email, email_merge_token, email_merge_token_created_at)
@email_merge_token = email_merge_token
@email_merge_token_created_at = email_merge_token_created_at
@subject = "Veuillez confirmer la fusion de compte"
mail(to: email, subject: @subject)

View file

@ -1,16 +1,17 @@
- content_for(:title, @subject)
- merge_link = france_connect_particulier_mail_merge_with_existing_account_url(email_merge_token: @email_merge_token)
%p
Bonjour,
%p
Pour confirmer la fusion de votre compte, veuillez cliquer sur le lien suivant :
= round_button 'Je confirme', france_connect_particulier_mail_merge_with_existing_account_url(merge_token: @merge_token), :primary
= round_button 'Je confirme', merge_link, :primary
%p
Vous pouvez aussi visiter ce lien : #{link_to france_connect_particulier_mail_merge_with_existing_account_url(merge_token: @merge_token), france_connect_particulier_mail_merge_with_existing_account_url(merge_token: @merge_token)}
Vous pouvez aussi visiter ce lien : #{link_to merge_link, merge_link}
%p Ce lien est valide #{distance_of_time_in_words(FranceConnectInformation::MERGE_VALIDITY)}, jusqu'à #{@merge_token_created_at.strftime("%d-%m-%Y à %H:%M (%Z)")}
%p Ce lien est valide #{distance_of_time_in_words(FranceConnectInformation::MERGE_VALIDITY)}, jusqu'à #{@email_merge_token_created_at.strftime("%d-%m-%Y à %H:%M (%Z)")}
%p
Si vous nêtes pas à lorigine de cette demande, vous pouvez ignorer ce message. Et si vous avez besoin dassistance, nhésitez pas à nous contacter à

View file

@ -65,7 +65,7 @@ RSpec.describe UserMailer, type: :mailer do
subject { described_class.france_connect_merge_confirmation(email, code, 15.minutes.from_now) }
it { expect(subject.to).to eq([email]) }
it { expect(subject.body).to include(france_connect_particulier_mail_merge_with_existing_account_url(merge_token: code)) }
it { expect(subject.body).to include(france_connect_particulier_mail_merge_with_existing_account_url(email_merge_token: code)) }
context 'without SafeMailer configured' do
it { expect(subject[BalancerDeliveryMethod::FORCE_DELIVERY_METHOD_HEADER]&.value).to eq(nil) }