Merge pull request #5441 from adullact/5440_allow_to_disable_FranceConnect
Développement : ajout d'une variable d'environnement optionnelle `FRANCE_CONNECT_ENABLED` pour activer ou non France Connect
This commit is contained in:
commit
9bfd521a19
4 changed files with 26 additions and 12 deletions
|
@ -2,7 +2,11 @@ class FranceConnect::ParticulierController < ApplicationController
|
|||
before_action :redirect_to_login_if_fc_aborted, only: [:callback]
|
||||
|
||||
def login
|
||||
if FranceConnectService.enabled?
|
||||
redirect_to FranceConnectService.authorization_uri
|
||||
else
|
||||
redirect_to new_user_session_path
|
||||
end
|
||||
end
|
||||
|
||||
def callback
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
class FranceConnectService
|
||||
def self.enabled?
|
||||
ENV.fetch("FRANCE_CONNECT_ENABLED", "enabled") == "enabled"
|
||||
end
|
||||
|
||||
def self.authorization_uri
|
||||
client = FranceConnectParticulierClient.new
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
- if FranceConnectService.enabled?
|
||||
.france-connect-login
|
||||
%h2
|
||||
= t('views.shared.france_connect_login.title')
|
||||
|
@ -9,3 +10,5 @@
|
|||
= link_to t('views.shared.france_connect_login.help_link'), "https://franceconnect.gouv.fr/", target: "_blank", rel: "noopener", class: "link"
|
||||
.france-connect-login-separator
|
||||
= t('views.shared.france_connect_login.separator')
|
||||
- else
|
||||
<!-- FranceConnect is not configured -->
|
||||
|
|
|
@ -6,6 +6,9 @@ APPLICATION_NAME="demarches-simplifiees.fr"
|
|||
APPLICATION_SHORTNAME="d-s.fr"
|
||||
APPLICATION_BASE_URL="https://www.demarches-simplifiees.fr"
|
||||
|
||||
# Utilisation de France Connect
|
||||
# FRANCE_CONNECT_ENABLED="disabled" # "enabled" par défaut
|
||||
|
||||
# Personnalisation d'instance - Adresses Email de l'application et téléphone
|
||||
# CONTACT_EMAIL=""
|
||||
# EQUIPE_EMAIL=""
|
||||
|
|
Loading…
Reference in a new issue