FC ParticulierController: use find or tap
This commit is contained in:
parent
7cbd6ed067
commit
c6c4dd7c7e
1 changed files with 2 additions and 6 deletions
|
@ -11,12 +11,8 @@ class FranceConnect::ParticulierController < ApplicationController
|
||||||
fetched_fc_information = FranceConnectService.retrieve_user_informations_particulier(params[:code])
|
fetched_fc_information = FranceConnectService.retrieve_user_informations_particulier(params[:code])
|
||||||
|
|
||||||
france_connect_information = FranceConnectInformation
|
france_connect_information = FranceConnectInformation
|
||||||
.find_by(france_connect_particulier_id: fetched_fc_information[:france_connect_particulier_id])
|
.find_by(france_connect_particulier_id: fetched_fc_information[:france_connect_particulier_id]) ||
|
||||||
|
fetched_fc_information.tap { |object| object.save }
|
||||||
if france_connect_information.nil?
|
|
||||||
fetched_fc_information.save
|
|
||||||
france_connect_information = fetched_fc_information
|
|
||||||
end
|
|
||||||
|
|
||||||
user = france_connect_information.user
|
user = france_connect_information.user
|
||||||
salt = FranceConnectSaltService.new(france_connect_information).salt
|
salt = FranceConnectSaltService.new(france_connect_information).salt
|
||||||
|
|
Loading…
Reference in a new issue