3 ms·
Django added a timeout period to the password reset in Django 1.2, it defaults to 3 days, the only issue I'm aware of is that it calculates the timeout in days
by huxley 14y ago
Django added a timeout period to the password reset in Django 1.2, it defaults to 3 days, the only issue I'm aware of is that it calculates the timeout in days which isn't very convenient if you want to be extra-careful.
https://docs.djangoproject.com/en/1.4/ref/settings/#std:setting-PASSWORD_RESET_TIMEOUT_DAYS https://docs.djangoproject.com/en/1.4/ref/settings/#std:sett...
Haven't looked too closely at it but Bruno Renié has a Django app that has done most of the heavy-lifting to make password reset customizable by providing as class-based views and changing the timeout period granularity to seconds (it defaults to 172800 seconds or 2 days):
https://github.com/brutasse/django-password-reset/ https://github.com/brutasse/django-password-reset/
http://django-password-reset.readthedocs.org/en/latest/ http://django-password-reset.readthedocs.org/en/latest/
- shabble 14y agoThe django-password-reset app appears to be pretty much equivalent to the django.contrib.auth.views version, except, as you say, with CBVs and perhaps some extra customisability in the templates and user lookup methods. The main criticism of both this and the contrib.auth are that they use the (hashed) user info directly, rather than generating a random code and associating it with the user in a lookup table. This app actually appears (on my brief inspection) to be less secure than the django.contrib.auth one, since it is using the django.core.signing.loads/dumps methods with a simple static salt, whilst the contrib.auth uses django.contrib.auth.tokens.PasswordResetTokenGenerator which includes a bunch more state in the token, so that it's auto-invalidated if the user subsequently logs in, changes their password, or other things). Personally, I wouldn't recommend it. I'm torn between the "standard" contrib.auth implementation, and the basic {random token, user, expiry} model espoused by tptacek and others throughout this thread. I am curious as to why the Django devs implemented this the way they did though, given the significant added complexity.