FC ParticulierController: remove superfluous if

This commit is contained in:
simon lehericey 2018-01-15 13:19:01 +01:00 committed by Simon Lehericey
parent 02395e732c
commit 34bd3a11e9

View file

@ -10,24 +10,22 @@ class FranceConnect::ParticulierController < ApplicationController
fetched_fc_information = FranceConnectService.retrieve_user_informations_particulier(params[:code]) fetched_fc_information = FranceConnectService.retrieve_user_informations_particulier(params[:code])
if fetched_fc_information.present? 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])
if france_connect_information.nil? if france_connect_information.nil?
fetched_fc_information.save fetched_fc_information.save
france_connect_information = fetched_fc_information 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)
end 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 rescue Rack::OAuth2::Client::Error => e
Rails.logger.error e.message Rails.logger.error e.message
redirect_france_connect_error_connection redirect_france_connect_error_connection