Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:omab/django-social-auth

  • Loading branch information...
commit d9d16affbb4fb7433302f6f25308f241af035d9b 2 parents c4c2094 + 671b3c7
@omab authored
View
9 social_auth/backends/contrib/evernote.py
@@ -53,6 +53,15 @@ class EvernoteBackend(OAuthBackend):
('edam_expires', 'expires')
]
+ @classmethod
+ def extra_data(cls, user, uid, response, details=None):
+ data = super(EvernoteBackend, cls).extra_data(user, uid, response, details)
+ # Evernote returns expiration timestamp in miliseconds, so it needs to
+ # be normalized.
+ if 'expires' in data:
+ data['expires'] = unicode(int(data['expires']) / 1000)
+ return data
+
def get_user_details(self, response):
"""Return user details from Evernote account"""
return {
View
6 social_auth/backends/contrib/vkontakte.py
@@ -16,7 +16,7 @@
from social_auth.backends import SocialAuthBackend, OAuthBackend, BaseAuth, \
BaseOAuth2
-from social_auth.exceptions import AuthTokenRevoked, AuthException
+from social_auth.exceptions import AuthTokenRevoked, AuthException, AuthCanceled, AuthFailed
from social_auth.utils import setting, log, dsa_urlopen
@@ -88,7 +88,7 @@ def auth_complete(self, *args, **kwargs):
if not 'id' in self.request.GET or \
not app_cookie in self.request.COOKIES:
- raise ValueError('VKontakte authentication is not completed')
+ raise AuthCanceled(self)
cookie_dict = dict(item.split('=') for item in
self.request.COOKIES[app_cookie].split('&'))
@@ -98,7 +98,7 @@ def auth_complete(self, *args, **kwargs):
hash = md5(check_str + setting('VKONTAKTE_APP_SECRET')).hexdigest()
if hash != cookie_dict['sig'] or int(cookie_dict['expire']) < time():
- raise ValueError('VKontakte authentication failed: invalid hash')
+ raise AuthFailed('VKontakte authentication failed: invalid hash')
else:
kwargs.update({
'auth': self,
Please sign in to comment.
Something went wrong with that request. Please try again.