Fixed a test that was broken at r16978. Refs #17055.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16993 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Aymeric Augustin 2011-10-16 09:46:01 +00:00
parent d3cd9c0d06
commit d75337fc7b
1 changed files with 5 additions and 1 deletions

View File

@ -52,8 +52,12 @@ class PasswordResetTokenGenerator(object):
# invalid as soon as it is used. # invalid as soon as it is used.
# We limit the hash to 20 chars to keep URL short # We limit the hash to 20 chars to keep URL short
key_salt = "django.contrib.auth.tokens.PasswordResetTokenGenerator" key_salt = "django.contrib.auth.tokens.PasswordResetTokenGenerator"
# Ensure results are consistent across DB backends
login_timestamp = user.last_login.replace(microsecond=0, tzinfo=None)
value = (unicode(user.id) + user.password + value = (unicode(user.id) + user.password +
unicode(user.last_login) + unicode(timestamp)) unicode(login_timestamp) + unicode(timestamp))
hash = salted_hmac(key_salt, value).hexdigest()[::2] hash = salted_hmac(key_salt, value).hexdigest()[::2]
return "%s-%s" % (ts_b36, hash) return "%s-%s" % (ts_b36, hash)