Django reset_password_confirm TemplateSyntaxError problem

I had this issue in Django 1.3, and wasted a lot of time because the error can mask a number of underlying issues.

I needed to add this to the top of the reset email template:

{% load url from future %}

Also, the example in the Django docs didn't match the sample url:

{{ protocol}}://{{ domain }}{% url 'auth_password_reset_confirm' uidb36=uid token=token %}

So I had to change the auth_password_reset_confirm above to password_reset_confirm.


Most likely it is an issue with your urls.py. You need to setup the right pattern to grab the uidb36 and token values passed as URL parameters. If not, it will throw a similar error to what you see above.

Something like:

(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', {'template_name' : 'registration/password_reset.html',  'post_reset_redirect': '/logout/' })

registration/password_reset.html - is my custom template

logout - is my custom logout action


If you're using Django 1.6+ and run into something like this it could be that you need to update uidb36 to uidb64 in both your template and your urls.

Example url: url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', auth_views.password_reset_confirm

and reset link in template:

{{ protocol}}://{{ domain }}{% url 'django.contrib.auth.views.password_reset_confirm' uidb64=uid token=token %}