FC ParticulierController: remove superfluous if
This commit is contained in:
parent
02395e732c
commit
34bd3a11e9
1 changed files with 14 additions and 16 deletions
|
@ -10,24 +10,22 @@ class FranceConnect::ParticulierController < ApplicationController
|
|||
|
||||
fetched_fc_information = FranceConnectService.retrieve_user_informations_particulier(params[:code])
|
||||
|
||||
if fetched_fc_information.present?
|
||||
france_connect_information = FranceConnectInformation
|
||||
.find_by(france_connect_particulier_id: fetched_fc_information[:france_connect_particulier_id])
|
||||
france_connect_information = FranceConnectInformation
|
||||
.find_by(france_connect_particulier_id: fetched_fc_information[:france_connect_particulier_id])
|
||||
|
||||
if france_connect_information.nil?
|
||||
fetched_fc_information.save
|
||||
france_connect_information = fetched_fc_information
|
||||
end
|
||||
|
||||
user = france_connect_information.user
|
||||
salt = FranceConnectSaltService.new(france_connect_information).salt
|
||||
|
||||
if user.nil?
|
||||
return redirect_to france_connect_particulier_new_path(fci_id: france_connect_information.id, salt: salt)
|
||||
end
|
||||
|
||||
connect_france_connect_particulier(user)
|
||||
if france_connect_information.nil?
|
||||
fetched_fc_information.save
|
||||
france_connect_information = fetched_fc_information
|
||||
end
|
||||
|
||||
user = france_connect_information.user
|
||||
salt = FranceConnectSaltService.new(france_connect_information).salt
|
||||
|
||||
if user.nil?
|
||||
return redirect_to france_connect_particulier_new_path(fci_id: france_connect_information.id, salt: salt)
|
||||
end
|
||||
|
||||
connect_france_connect_particulier(user)
|
||||
rescue Rack::OAuth2::Client::Error => e
|
||||
Rails.logger.error e.message
|
||||
redirect_france_connect_error_connection
|
||||
|
|
Loading…
Reference in a new issue