From: root Date: Fri, 29 Jul 2011 05:58:59 +0000 (+0700) Subject: cosmetics X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=db146a3201192c8b4128298c8c4dee0fa6c6ed90;p=django-social-auth.git cosmetics --- diff --git a/social_auth/backends/__init__.py b/social_auth/backends/__init__.py index bb9868a..612f738 100644 --- a/social_auth/backends/__init__.py +++ b/social_auth/backends/__init__.py @@ -232,13 +232,14 @@ class SocialAuthBackend(ModelBackend): kwargs = {'sender': self.__class__, 'user': user, 'response': response, 'details': details} - changed |= any(filter(signal_response, pre_update.send(**kwargs))) # Fire socialauth_registered signal on new user registration if is_new: changed |= any(filter(signal_response, socialauth_registered.send(**kwargs))) + changed |= any(filter(signal_response, pre_update.send(**kwargs))) + if changed: user.save() diff --git a/social_auth/backends/contrib/vkontakte.py b/social_auth/backends/contrib/vkontakte.py index 5d9191c..1e18328 100644 --- a/social_auth/backends/contrib/vkontakte.py +++ b/social_auth/backends/contrib/vkontakte.py @@ -16,13 +16,12 @@ from time import time from social_auth.backends import SocialAuthBackend, OAuthBackend, BaseAuth, BaseOAuth2, USERNAME -VKONTAKTE_LOCAL_HTML = 'vkontakte.html' - VKONTAKTE_API_URL = 'https://api.vkontakte.ru/method/' VKONTAKTE_OAUTH2_SCOPE = [''] # Enough for authentication EXPIRES_NAME = getattr(settings, 'SOCIAL_AUTH_EXPIRATION', 'expires') USE_APP_AUTH = getattr(settings, 'VKONTAKTE_APP_AUTH', False) +LOCAL_HTML = getattr(settings, 'VKONTAKTE_LOCAL_HTML', 'vkontakte.html') class VKontakteBackend(SocialAuthBackend): """VKontakte authentication backend""" @@ -75,7 +74,7 @@ class VKontakteAuth(BaseAuth): dict = { 'VK_APP_ID' : self.APP_ID, 'VK_COMPLETE_URL': reverse(settings.SOCIAL_AUTH_COMPLETE_URL_NAME, args=[VKontakteBackend.name]) } - vk_template = loader.get_template(VKONTAKTE_LOCAL_HTML) + vk_template = loader.get_template(LOCAL_HTML) context = RequestContext(self.request, dict) return vk_template.render(context) diff --git a/social_auth/backends/facebook.py b/social_auth/backends/facebook.py index 070f7c5..aa7f6f1 100644 --- a/social_auth/backends/facebook.py +++ b/social_auth/backends/facebook.py @@ -61,11 +61,10 @@ class FacebookAuth(BaseOAuth): return FACEBOOK_AUTHORIZATION_URL + '?' + urllib.urlencode(args) def auth_complete(self, *args, **kwargs): + """Returns user, might be logged in""" access_token = None expires = None - - """Returns user, might be logged in""" - + if 'code' in self.data: url = FACEBOOK_ACCESS_TOKEN_URL + '?' + \ urllib.urlencode({'client_id': settings.FACEBOOK_APP_ID,