Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix facebook login
Artur Smętddd5dd4a3201
diff --git a/saleor/core/context_processors.py b/saleor/core/context_processors.pyindex 6431659fe2..1817656264 100644--- a/saleor/core/context_processors.py+++ b/saleor/core/context_processors.py@@ -25,3 +25,7 @@ def categories(request):def search_enabled(request):return {'SEARCH_IS_ENABLED': bool(settings.SEARCH_BACKENDS)}+++def social_account_providers(request):+ return get_setting_as_dict('SOCIALACCOUNT_PROVIDERS')diff --git a/saleor/settings.py b/saleor/settings.pyindex 3c3dd7b164..298b461ca3 100644--- a/saleor/settings.py+++ b/saleor/settings.py@@ -92,6 +92,7 @@ context_processors = ['saleor.core.context_processors.categories','saleor.cart.context_processors.cart_counter','saleor.core.context_processors.search_enabled',+ 'saleor.core.context_processors.social_account_providers',]loaders = [@@ -172,7 +173,8 @@ INSTALLED_APPS = ['webpack_loader','allauth','allauth.account',- 'allauth.socialaccount'+ 'allauth.socialaccount',+ 'allauth.socialaccount.providers.facebook',]LOGGING = {@@ -324,6 +326,12 @@ ACCOUNT_USERNAME_REQUIRED = FalseSOCIALACCOUNT_EMAIL_VERIFICATION = FalseACCOUNT_LOGOUT_ON_GET = TrueACCOUNT_ADAPTER = 'saleor.userprofile.adapters.AccountAdapter'+SOCIALACCOUNT_PROVIDERS = {+ 'facebook': {+ 'SCOPE': ['email'],+ 'METHOD': 'oauth2'+ }+}ELASTICSEARCH_URL = os.environ.get('ELASTICSEARCH_URL')diff --git a/templates/account/login.html b/templates/account/login.htmlindex 994c0ad903..86d0be068f 100644--- a/templates/account/login.html+++ b/templates/account/login.html@@ -28,16 +28,17 @@<a href="{% url 'account_reset_password' %}">{% trans "Forgot password?" %}</a></div></div>- {% get_providers as socialaccount_providers %}- {% if socialaccount_providers %}+ {% if SOCIALACCOUNT_PROVIDERS %}+ {% include "socialaccount/snippets/login_extra.html" %}+<p>{% trans "Want to use your social profile?" %}</p><p>- {% if facebook_login_url %}+ {% if "facebook" in SOCIALACCOUNT_PROVIDERS %}<a class="btn btn-default" href="{% provider_login_url "facebook" method="oauth2" %}">{% trans "Log in using Facebook" %}</a>{% endif %}- {% if google_login_url %}+ {% if 'google' in SOCIALACCOUNT_PROVIDERS %}<a class="btn btn-default" href="{% provider_login_url "google" %}"> {% trans "Log in using Google" %}</a>{% endif %}</p>