From cf52a2afcce085d5127b9b251902c64e88b3200f Mon Sep 17 00:00:00 2001 From: Dan Braghis <dan.braghis@torchbox.com> Date: Thu, 11 Jan 2018 15:24:28 +0000 Subject: [PATCH] Tweak social auth settings --- opentech/settings/base.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/opentech/settings/base.py b/opentech/settings/base.py index b3b9d40e4..790a22884 100644 --- a/opentech/settings/base.py +++ b/opentech/settings/base.py @@ -73,6 +73,8 @@ MIDDLEWARE = [ 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'social_django.middleware.SocialAuthExceptionMiddleware', + 'wagtail.wagtailcore.middleware.SiteMiddleware', 'wagtail.wagtailredirects.middleware.RedirectMiddleware', 'opentech.public.esi.middleware.ESIMiddleware', @@ -276,10 +278,28 @@ ENABLE_STYLEGUIDE = False # Social Auth SOCIAL_AUTH_URL_NAMESPACE = 'social' -SOCIAL_AUTH_GOOGLEOAUTH2_WHITELISTED_DOMAINS = ['opentechfund.org'] # Set the Google OAuth2 credentials in ENV variables or local.py # To create a new set of credentials, go to https://console.developers.google.com/apis/credentials # Make sure the Google+ API is enabled for your API project +SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS = ['opentechfund.org'] SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '' SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = '' + +SOCIAL_AUTH_LOGIN_ERROR_URL = 'users:account' +SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = 'users:account' + +# For pipelines, see http://python-social-auth.readthedocs.io/en/latest/pipeline.html?highlight=pipelines#authentication-pipeline +# Create / associate accounts (including by email) +SOCIAL_AUTH_PIPELINE = ( + 'social_core.pipeline.social_auth.social_details', + 'social_core.pipeline.social_auth.social_uid', + 'social_core.pipeline.social_auth.auth_allowed', + 'social_core.pipeline.social_auth.social_user', + 'social_core.pipeline.user.get_username', + 'social_core.pipeline.user.create_user', + 'social_core.pipeline.social_auth.associate_user', + 'social_core.pipeline.social_auth.load_extra_data', + 'social_core.pipeline.user.user_details', + 'social_core.pipeline.social_auth.associate_by_email', +) -- GitLab