From: Matías Aguirre Date: Thu, 14 Apr 2011 13:07:58 +0000 (-0300) Subject: Fix email association if clause. Closes gh-51. X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=c66baf9a2cef370cd28be812b705c2c4597435cc;p=django-social-auth.git Fix email association if clause. Closes gh-51. --- diff --git a/social_auth/backends/__init__.py b/social_auth/backends/__init__.py index 8e867c8..5325660 100644 --- a/social_auth/backends/__init__.py +++ b/social_auth/backends/__init__.py @@ -115,7 +115,10 @@ class SocialAuthBackend(ModelBackend): return None email = details.get('email') - if ASSOCIATE_BY_MAIL: + if email and ASSOCIATE_BY_MAIL: + # try to associate accounts registered with the same email + # address, only if it's a single object. ValueError is + # raised if multiple objects are returned try: user = User.objects.get(email=email) except MultipleObjectsReturned: