From d90554ebd70b4a13663c2acb77697c2687a38b34 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C3=ADas=20Aguirre?= Date: Wed, 5 Jan 2011 13:08:43 -0200 Subject: [PATCH] Replaced deprecated md5 import, Refs gh-7 --- social_auth/backends.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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() -- 2.39.5