Browse files

Merge pull request #621 from syabro/patch-1

Fixed ValueError to AuthCanceled and AuthFailed in vkontakte backend
  • Loading branch information...
2 parents adc462d + 91d8b68 commit 671b3c7982e064895162d85cc09c66426f3a2d6e @omab committed Mar 3, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 social_auth/backends/contrib/vkontakte.py
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,

0 comments on commit 671b3c7

Please sign in to comment.