From 7f8a95928cff98afee1b0e2d82675ae80aae348c Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Mon, 26 May 2014 22:52:38 +0200 Subject: [PATCH] settings: make the authentic social account provider non mandatory --- portail_citoyen2/settings.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/portail_citoyen2/settings.py b/portail_citoyen2/settings.py index 727de8b..9e50e41 100644 --- a/portail_citoyen2/settings.py +++ b/portail_citoyen2/settings.py @@ -131,7 +131,6 @@ INSTALLED_APPS = ( 'allauth.account', 'allauth.socialaccount', # ... include the providers you want to enable: - 'portail_citoyen2.allauth_authentic2', 'portail_citoyen2', ) @@ -142,17 +141,19 @@ AUTHENTICATION_BACKENDS = ( # auth and allauth settings LOGIN_REDIRECT_URL = os.environ.get('LOGIN_REDIRECT_URL', '/') LOGOUT_URL = os.environ.get('LOGOUT_URL', '/accounts/logout/') -LOGIN_URL = os.environ.get('LOGIN_URL', '/accounts/authentic2/login/?process=login') -SOCIALACCOUNT_QUERY_EMAIL = True -SOCIALACCOUNT_PROVIDERS = { - 'authentic2': { - 'URL': os.environ.get('AUTHENTIC2_URL', '') + '/idp/oauth2/', - 'SCOPE': ['read', 'write'], - }, -} -SOCIALACOUNT_AUTO_SIGNUP = True +if 'AUTHENTIC2_URL' in os.environ: + INSTALLED_APPS += ('portail_citoyen2.allauth_authentic2',) + LOGIN_URL = os.environ.get('LOGIN_URL', '/accounts/authentic2/login/?process=login') + SOCIALACCOUNT_QUERY_EMAIL = True + SOCIALACCOUNT_PROVIDERS = { + 'authentic2': { + 'URL': os.environ.get('AUTHENTIC2_URL', '') + '/idp/oauth2/', + 'SCOPE': ['read', 'write'], + }, + } + SOCIALACOUNT_AUTO_SIGNUP = True ACCOUNT_LOGOUT_ON_GET = True -ACCOUNT_UNIQUE_EMAIL = False +ACCOUNT_UNIQUE_EMAIL = True MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'