summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2011-10-16 09:46:01 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2011-10-16 09:46:01 +0000
commitd75337fc7b63400a4d866955d84d3092822c95ab (patch)
treec6b3678c3f68fdb76426838f19a652fd5828d477
parentd3cd9c0d0675e5067562a21b5341223ebd157761 (diff)
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
-rw-r--r--django/contrib/auth/tokens.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/contrib/auth/tokens.py b/django/contrib/auth/tokens.py
index a75ef61e51..fcc8c94011 100644
--- a/django/contrib/auth/tokens.py
+++ b/django/contrib/auth/tokens.py
@@ -52,8 +52,12 @@ class PasswordResetTokenGenerator(object):
# invalid as soon as it is used.
# We limit the hash to 20 chars to keep URL short
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 +
- unicode(user.last_login) + unicode(timestamp))
+ unicode(login_timestamp) + unicode(timestamp))
hash = salted_hmac(key_salt, value).hexdigest()[::2]
return "%s-%s" % (ts_b36, hash)