Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django built-in password reset, what's wrong with my urls?

Tags:

django

Everyone seems to point to this guide for easy plug-in password reset: http://garmoncheg.blogspot.com.au/2012/07/django-resetting-passwords-with.html

So from what I've read, if you want it to function then the urls are all you need are 4 urls defined:

urlpatterns = patterns('',
 . . . 
    url(r'^user/password/reset/$', 'django.contrib.auth.views.password_reset', {'post_reset_redirect' : '/user/password/reset/done/'}, name="password_reset"),
        (r'^user/password/reset/done/$', 'django.contrib.auth.views.password_reset_done'),
        (r'^user/password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', {'post_reset_redirect' : '/user/password/done/'}),
        (r'^user/password/done/$', 'django.contrib.auth.views.password_reset_complete'),
 . . .
)

This does not seem to be working as I'm still getting the infamous

NoReverseMatch at /user/password/reset/

with this:

Reverse for 'password_reset_confirm' with arguments '()' and keyword arguments '{u'uidb64': 'NA', u'token': u'3ps-749165b2b39d4168f97f'}' not found. 1 pattern(s) tried: ['user/password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$']

Is there something depreciated already with the guide I put a link to at the top? Should I be importing anything to the urls.py file?

like image 374
user1504605 Avatar asked Oct 02 '22 08:10

user1504605


1 Answers

Your url pattern is using uidb36, but your reverse call is looking for uidb64. See the documentation for more information on this change in 1.6.

like image 65
Kevin Christopher Henry Avatar answered Oct 13 '22 11:10

Kevin Christopher Henry