hln
hln

Reputation: 1106

reset password in Django 1.6

I got an errror when I try to reset my password by use django password reset:

*The current URL, /reset/Nw/3u5-5654a2cadfa432b86577/, didn't match any of these.*

in url.py I have

 urlpatterns+=patterns('',
 url(r'^resetpassword/$', 'django.contrib.auth.views.password_reset',name='password_reset_done'),
 (r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm'),
 (r'^resetpassword/passwordsent/$', 'django.contrib.auth.views.password_reset_done'),
 (r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
 )+static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)+staticfiles_urlpatterns()

What can be wrong here?

Upvotes: 0

Views: 109

Answers (1)

orokusaki
orokusaki

Reputation: 57118

The problem is that your path begins with 2 slashes, so it's currently //reset/Nw/3u5-5654a2cadfa432b86577/ (when your path begins with just 1 slash, Django doesn't use the first one to match against your pattern, which is why the "URL" it's showing you in the error message only begins with 1 slash).

You probably have something like this in your code: <domain>/{{ obj.path }}

Solution:

Remove the extra slash from the path you're returning, which will result in the path being /reset/Nw/3u5-5654a2cadfa432b86577/.

Upvotes: 1

Related Questions