Browse files

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
  • Loading branch information...
1 parent d3cd9c0 commit d75337fc7b63400a4d866955d84d3092822c95ab @aaugustin aaugustin committed Oct 16, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 django/contrib/auth/tokens.py
View
6 django/contrib/auth/tokens.py
@@ -52,8 +52,12 @@ def _make_token_with_timestamp(self, user, timestamp):
# 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)

0 comments on commit d75337f

Please sign in to comment.