mirror of
https://github.com/django/django.git
synced 2025-10-27 15:46:10 +00:00
Fixed #16906 -- Format datetimes with str/unicode instead of strftime where possible: it's faster and it works for all dates.
Also ensured that datetime_safe is used wherever strftime is called on dates/datetimes that may be before 1900. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16978 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -52,14 +52,13 @@ 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"
|
||||
value = unicode(user.id) + \
|
||||
user.password + user.last_login.strftime('%Y-%m-%d %H:%M:%S') + \
|
||||
unicode(timestamp)
|
||||
value = (unicode(user.id) + user.password +
|
||||
unicode(user.last_login) + unicode(timestamp))
|
||||
hash = salted_hmac(key_salt, value).hexdigest()[::2]
|
||||
return "%s-%s" % (ts_b36, hash)
|
||||
|
||||
def _num_days(self, dt):
|
||||
return (dt - date(2001,1,1)).days
|
||||
return (dt - date(2001, 1, 1)).days
|
||||
|
||||
def _today(self):
|
||||
# Used for mocking in tests
|
||||
|
||||
Reference in New Issue
Block a user