feat(UserMailer.france_connect_merge_confirmation): in addition to distance_of_time_in_words, add exact expiration date

This commit is contained in:
Martin 2021-11-23 10:54:59 +01:00
parent 21894d0a0a
commit 8a315a4ac1
4 changed files with 5 additions and 4 deletions

View file

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

View file

@ -10,7 +10,7 @@
%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)}
%p Ce lien est valide #{distance_of_time_in_words(FranceConnectInformation::MERGE_VALIDITY)}.
%p Ce lien est valide #{distance_of_time_in_words(FranceConnectInformation::MERGE_VALIDITY)}, jusqu'à #{I18n.l(@merge_token_created_at, format: "%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

@ -13,7 +13,7 @@ class UserMailerPreview < ActionMailer::Preview
end
def france_connect_merge_confirmation
UserMailer.france_connect_merge_confirmation('new.exemple.fr', '123456')
UserMailer.france_connect_merge_confirmation('new.exemple.fr', '123456', 15.minutes.from_now)
end
private

View file

@ -30,7 +30,7 @@ RSpec.describe UserMailer, type: :mailer do
let(:email) { 'new.exemple.fr' }
let(:code) { '123456' }
subject { described_class.france_connect_merge_confirmation(email, code) }
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)) }