Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mattucf/django-social-auth
Browse files Browse the repository at this point in the history
…into mattucf-master
  • Loading branch information
omab committed Jan 17, 2011
2 parents 96da6aa + e459eec commit e9b466f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 11 additions & 5 deletions social_auth/backends.py
Expand Up @@ -59,7 +59,17 @@ def authenticate(self, *args, **kwargs):
else:
user = social_user.user

# Update the user account data.
self.update_user_details(user, response, details, new_user=new_user)

# Update the extra_data storage, unless disabled by setting.
extra_data = '' if not getattr(settings, 'SOCIAL_AUTH_EXTRA_DATA',
True) \
else self.extra_data(user, uid, response, details)
if extra_data:
social_user.extra_data = extra_data
social_user.save()

return user

def username(self, details):
Expand Down Expand Up @@ -94,12 +104,8 @@ def get_random_username():

def associate_auth(self, user, uid, response, details):
"""Associate a Social Auth with an user account."""
extra_data = '' if not getattr(settings, 'SOCIAL_AUTH_EXTRA_DATA',
False) \
else self.extra_data(user, uid, response, details)
return UserSocialAuth.objects.create(user=user, uid=uid,
provider=self.name,
extra_data=extra_data)
provider=self.name)

def extra_data(self, user, uid, response, details):
"""Return default blank user extra data"""
Expand Down
4 changes: 3 additions & 1 deletion social_auth/conf.py
Expand Up @@ -3,7 +3,9 @@
TWITTER_SERVER = 'api.twitter.com'
TWITTER_REQUEST_TOKEN_URL = 'https://%s/oauth/request_token' % TWITTER_SERVER
TWITTER_ACCESS_TOKEN_URL = 'https://%s/oauth/access_token' % TWITTER_SERVER
TWITTER_AUTHORIZATION_URL = 'http://%s/oauth/authorize' % TWITTER_SERVER
# Note: oauth/authorize forces the user to authorize every time.
# oauth/authenticate uses their previous selection, barring revocation.
TWITTER_AUTHORIZATION_URL = 'http://%s/oauth/authenticate' % TWITTER_SERVER
TWITTER_CHECK_AUTH = 'https://twitter.com/account/verify_credentials.json'

# Facebook configuration
Expand Down

0 comments on commit e9b466f

Please sign in to comment.