from social_auth.utils import setting
-from social_auth.models import User
+from social_auth.models import get_user_by_email
from social_auth.backends.pipeline import warn_setting
from social_auth.backends.exceptions import AuthException
# only if it's a single object. AuthException is raised if multiple
# objects are returned
try:
- return {'user': User.objects.get(email=email)}
+ return {'user': get_user_by_email(email=email)}
except User.MultipleObjectsReturned:
raise AuthException(kwargs['backend'], 'Not unique email address.')
except User.DoesNotExist:
return None
+def get_user_by_email(email):
+ return User.objects.get(email=email)
+
+
def get_social_auth_for_user(user):
return user.social_auth.all()
return None
+def get_user_by_email(email):
+ return User.objects.get(email=email)
+
+
def get_social_auth_for_user(user):
return UserSocialAuth.objects(user=user)