From 66e6abc2589439f1f3060a04de126e876145a08d Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Mon, 9 Dec 2024 15:12:37 +0100 Subject: [PATCH] fix(fc): useless exception when user has already created --- app/models/france_connect_information.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/france_connect_information.rb b/app/models/france_connect_information.rb index 82fad522ca3..7a04e7c7585 100644 --- a/app/models/france_connect_information.rb +++ b/app/models/france_connect_information.rb @@ -15,6 +15,8 @@ def safely_associate_user!(email) password: Devise.friendly_token[0, 20], confirmed_at: Time.zone.now ) + + update_attribute('user_id', user.id) rescue ActiveRecord::RecordNotUnique # ignore this exception because we check before if user is nil. # exception can be raised in race conditions, when FranceConnect calls callback 2 times. @@ -23,7 +25,6 @@ def safely_associate_user!(email) end clean_tokens_and_requested_email - update_attribute('user_id', user.id) save! end