france_connect: raise an error if some validation error occurs
If a validation error occurs in `find_or_create`, an object without `id` will be returned–and the code will crash soon after. Ensure that we crash immediately, so that we can report the root cause (the validation error) instead of a seemingly-unrelated crash later.
This commit is contained in:
parent
6b27ac8514
commit
06afc3890f
1 changed files with 1 additions and 1 deletions
|
@ -13,7 +13,7 @@ class FranceConnect::ParticulierController < ApplicationController
|
||||||
fetched_fci.tap(&:save)
|
fetched_fci.tap(&:save)
|
||||||
|
|
||||||
if fci.user.nil?
|
if fci.user.nil?
|
||||||
user = User.find_or_create_by(email: fci.email_france_connect.downcase) do |new_user|
|
user = User.find_or_create_by!(email: fci.email_france_connect.downcase) do |new_user|
|
||||||
new_user.password = Devise.friendly_token[0, 20]
|
new_user.password = Devise.friendly_token[0, 20]
|
||||||
new_user.confirmed_at = Time.zone.now
|
new_user.confirmed_at = Time.zone.now
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue