Skip to content

Commit

Permalink
Fix twitter first_name/last_name filling. Closes omabgh-146
Browse files Browse the repository at this point in the history
  • Loading branch information
omab committed Sep 19, 2011
1 parent f3339cc commit 07b1d30
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions social_auth/backends/twitter.py
Expand Up @@ -36,11 +36,16 @@ class TwitterBackend(OAuthBackend):

def get_user_details(self, response):
"""Return user details from Twitter account"""
try:
first_name, last_name = response['name'].split(' ', 1)
except:
first_name = response['name']
last_name = ''
return {USERNAME: response['screen_name'],
'email': '', # not supplied
'fullname': response['name'],
'first_name': response['name'],
'last_name': ''}
'first_name': first_name,
'last_name': last_name}


class TwitterAuth(ConsumerBasedOAuth):
Expand Down

0 comments on commit 07b1d30

Please sign in to comment.