Skip to main content

How to Create a Password Reset View

(This is something that I wrote on simpleisbetterthancomplex.com.)

Note that if you use the urls.py provided above, rather than including django.contrib.auth.urls, note that the “password_reset_confirm” URL pattern should be changed. The token can now be longer than 20 characters so it would not match the pattern provided here, causing an error when no matching URL pattern is found.

The current auth URL patterns are more forgiving, so the line should be changed to something like this:

url(
    r'^reset/(?P<uidb64>)/(?P<token>)/$',
    auth_views.password_reset_confirm,
    name='password_reset_confirm'
),

See on simpleisbetterthancomplex.com.