]> git.parisson.com Git - django-social-auth.git/commitdiff
Protect email access for those users that don't disclose yhaoo email.
authorMatías Aguirre <matiasaguirre@gmail.com>
Wed, 9 May 2012 06:08:51 +0000 (03:08 -0300)
committerMatías Aguirre <matiasaguirre@gmail.com>
Wed, 9 May 2012 06:08:51 +0000 (03:08 -0300)
social_auth/backends/contrib/yahoo.py

index 9ac234bbee099207bdd3f6502f139381b4a6b5df..2e1b3f2536419ccd4d3c87dc1a2b9b7eefa4b54b 100644 (file)
@@ -49,8 +49,12 @@ class YahooOAuthBackend(OAuthBackend):
         """Return user details from Yahoo Profile"""
         fname = response.get('givenName')
         lname = response.get('familyName')
+        if 'emails' in response:
+            email = response.get('emails')[0]['handle']
+        else:
+            email = ''
         return {USERNAME:     response.get('nickname'),
-                'email':      response.get('emails')[0]['handle'],
+                'email':      email,
                 'fullname':   '%s %s' % (fname, lname),
                 'first_name': fname,
                 'last_name':  lname}