From 51a4a5702cf49a4200365206e55e6aadca594cd8 Mon Sep 17 00:00:00 2001 From: Stas Kravets Date: Wed, 19 Jan 2011 16:14:22 +0300 Subject: [PATCH] Fixed openid issue, switch to hashlib from md5 library. --- social_auth/backends/__init__.py | 2 +- social_auth/backends/contrib/vkontakte.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/social_auth/backends/__init__.py b/social_auth/backends/__init__.py index 813e79d..eff0642 100644 --- a/social_auth/backends/__init__.py +++ b/social_auth/backends/__init__.py @@ -489,7 +489,7 @@ SOCIAL_AUTH_IMPORT_SOURCES = ( ) + getattr(settings, 'SOCIAL_AUTH_IMPORT_BACKENDS', ()) def get_backends(): - backends = {} + backends = {'openid' : OpenIdAuth} for mod_name in SOCIAL_AUTH_IMPORT_SOURCES: try: diff --git a/social_auth/backends/contrib/vkontakte.py b/social_auth/backends/contrib/vkontakte.py index 673ec41..f38158d 100644 --- a/social_auth/backends/contrib/vkontakte.py +++ b/social_auth/backends/contrib/vkontakte.py @@ -8,7 +8,7 @@ www.vkontakte.ru. Username is retrieved from the identity returned by server. from django.conf import settings from django.contrib.auth import authenticate from urllib import unquote -import md5 +from hashlib import md5 from social_auth.backends import SocialAuthBackend, BaseAuth, USERNAME @@ -58,7 +58,7 @@ class VKontakteAuth(BaseAuth): cookie_dict = dict(item.split('=') for item in self.request.COOKIES[app_cookie].split('&')) check_str = ''.join([item + '=' + cookie_dict[item] for item in ['expire', 'mid', 'secret', 'sid']]) - hash = md5.new(check_str + settings.VKONTAKTE_APP_SECRET).hexdigest() + hash = md5(check_str + settings.VKONTAKTE_APP_SECRET).hexdigest() if hash != cookie_dict['sig']: raise ValueError('VKontakte authentication failed: invalid hash') -- 2.39.5