2

I'd like users to be be able to reset their passwords via a link on my site. I'm trying to use the built in django password reset form, but having a little difficulty. I have the following included in my urls.py

urlpatterns = patterns('',
    url(r'^admin/password_reset/$', 'django.contrib.auth.views.password_reset', name='admin_password_reset'),
    url(r'^admin/password_reset/done/$', 'django.contrib.auth.views.password_reset_done'),
    url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm'),
    url(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
    url(r'^admin/', include(admin.site.urls)),

I access the link in the following way:

<h3><a href="{% url 'password_reset' %}">Forgot your password?</a></h3>

I've also tried including it like this:

{% url django.contrib.auth.views.password_reset_confirm uid, token %}
{% url django.contrib.auth.views.password_reset_confirm uidb36=uid, token=token %}

I get the following error:

NoReverseMatch at /account/
Reverse for 'password_reset' with arguments '()' and keyword arguments '{}' not found.

I've tried a bunch of different tings without any luck. Do I need to pass in the uid/token? If so, how do I define them?

Thank you for your help

2 Answers 2

1

Your url is named admin_password_reset

<h3><a href="{% url 'admin_password_reset' %}">Forgot your password?</a></h3>

Sign up to request clarification or add additional context in comments.

1 Comment

That did it! Though I did need the quotes around the url name. Thank you!
0

This sounds very similar to an issue I had. You might check my solution: Django {% url %} reverse not working if you are using {% load url from future %}.

Good luck!

1 Comment

Thanks -- that helped some I think. I updated the error messages and code to match

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.