refactor controller to avoid return
This commit is contained in:
parent
5aaf46258a
commit
06dee2e023
1 changed files with 5 additions and 4 deletions
|
@ -13,14 +13,15 @@ class FranceConnect::ParticulierController < ApplicationController
|
|||
fci = FranceConnectService.find_or_retrieve_france_connect_information(params[:code])
|
||||
fci.associate_user!
|
||||
|
||||
if fci.user && !fci.user.can_france_connect?
|
||||
user = fci.user
|
||||
|
||||
if user.can_france_connect?
|
||||
connect_france_connect_particulier(user)
|
||||
else
|
||||
fci.destroy
|
||||
redirect_to new_user_session_path, alert: t('errors.messages.france_connect.forbidden_html', reset_link: new_user_password_path)
|
||||
return
|
||||
end
|
||||
|
||||
connect_france_connect_particulier(fci.user)
|
||||
|
||||
rescue Rack::OAuth2::Client::Error => e
|
||||
Rails.logger.error e.message
|
||||
redirect_france_connect_error_connection
|
||||
|
|
Loading…
Reference in a new issue