Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix login with Facebook and Google

Paweł Kowalewskide72369f7354
diff --git a/saleor/registration/templates/registration/login.html b/saleor/registration/templates/registration/login.html
index 2ef6d88dfc..86772a5473 100644
--- a/saleor/registration/templates/registration/login.html
+++ b/saleor/registration/templates/registration/login.html
@@ -25,19 +25,15 @@
</div>
<hr>
{% if facebook_login_url or google_login_url %}
- <div class="form-group">
- <div class="col-sm-offset-2 col-sm-10">
- <p>{% trans "Want to use your social profile?" %}</p>
- <p>
- {% if facebook_login_url %}
- <a class="btn btn-default zocial-facebook" href="{{ facebook_login_url }}"> {% trans "Log in using Facebook" %}</a>
- {% endif %}
- {% if google_login_url %}
- <a class="btn btn-default zocial-google" href="{{ google_login_url }}"> {% trans "Log in using Google" %}</a>
- {% endif %}
- </p>
- </div>
- </div>
+ <p>{% trans "Want to use your social profile?" %}</p>
+ <p>
+ {% if facebook_login_url %}
+ <a class="btn btn-default" href="{{ facebook_login_url }}"> {% trans "Log in using Facebook" %}</a>
+ {% endif %}
+ {% if google_login_url %}
+ <a class="btn btn-default" href="{{ google_login_url }}"> {% trans "Log in using Google" %}</a>
+ {% endif %}
+ </p>
<hr>
{% endif %}
<div class="form-group">
diff --git a/saleor/registration/utils.py b/saleor/registration/utils.py
index cd0deb8277..761335da0a 100644
--- a/saleor/registration/utils.py
+++ b/saleor/registration/utils.py
@@ -156,7 +156,7 @@ class GoogleClient(OAuth2Client):
def get_user_info(self):
response = super(GoogleClient, self).get_user_info()
- if response['verified_email']:
+ if response.get('verified_email'):
return response
else:
raise ValueError('Google account not verified.')
@@ -183,7 +183,7 @@ class FacebookClient(OAuth2Client):
def get_user_info(self):
response = super(FacebookClient, self).get_user_info()
- if response['verified']:
+ if response.get('verified'):
return response
else:
raise ValueError('Facebook account not verified.')
diff --git a/saleor/userprofile/models.py b/saleor/userprofile/models.py
index 68720a2632..e09c99e2be 100644
--- a/saleor/userprofile/models.py
+++ b/saleor/userprofile/models.py
@@ -79,14 +79,6 @@ class Address(models.Model):
class UserManager(BaseUserManager):
- def get_or_create(self, **kwargs):
- defaults = kwargs.pop('defaults', {})
- try:
- return self.get_query_set().get(**kwargs), False
- except self.model.DoesNotExist:
- defaults.update(kwargs)
- return self.create_user(**defaults), True
-
def create_user(self, email, password=None, is_staff=False,
is_active=True, **extra_fields):
'Creates a User with the given username, email and password'