Skip to content

Commit

Permalink
fix(fc): useless exception when user has already created
Browse files Browse the repository at this point in the history
  • Loading branch information
colinux committed Dec 9, 2024
1 parent b848179 commit 66e6abc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/france_connect_information.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 19 in app/models/france_connect_information.rb

View check run for this annotation

Codecov / codecov/patch

app/models/france_connect_information.rb#L19

Added line #L19 was not covered by tests
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.
Expand All @@ -23,7 +25,6 @@ def safely_associate_user!(email)
end

clean_tokens_and_requested_email
update_attribute('user_id', user.id)
save!
end

Expand Down

0 comments on commit 66e6abc

Please sign in to comment.