From: Matías Aguirre Date: Wed, 5 Jan 2011 15:08:43 +0000 (-0200) Subject: Replaced deprecated md5 import, Refs gh-7 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=d90554ebd70b4a13663c2acb77697c2687a38b34;p=django-social-auth.git Replaced deprecated md5 import, Refs gh-7 --- diff --git a/social_auth/backends.py b/social_auth/backends.py index ee5ce5a..374ffe3 100644 --- a/social_auth/backends.py +++ b/social_auth/backends.py @@ -1,8 +1,9 @@ """ Authentication backeds for django.contrib.auth AUTHENTICATION_BACKENDS setting """ -import os -import md5 +from os import urandom +from hashlib import md5 + from openid.extensions import ax, sreg from django.conf import settings @@ -66,7 +67,7 @@ class SocialAuthBackend(ModelBackend): """ def get_random_username(): """Return hash from random string cut at 30 chars""" - return md5.md5(str(os.urandom(10))).hexdigest()[:30] + return md5(str(urandom(10))).hexdigest()[:30] if getattr(settings, 'SOCIAL_AUTH_FORCE_RANDOM_USERNAME', False): username = get_random_username()