Search code examples
djangopasswordsdjango-urlsdjango-1.7

django - reset password views issue


I have been unable to solve this issue after spending 3 hours trying and searching SO & Google.

I am trying to set up the reset password function.

Here is my urls:

urlpatterns += patterns('', url(r'^reset_password/$', 'django.contrib.auth.views.password_reset', {'template_name': 'users/reset_password.html', 'email_template_name': 'users/reset_password_email.txt', 'subject_template_name': 'users/reset_password_subject.txt', 'extra_context': {'languages': LANGUAGES, }, }, name='reset_password'), )

urlpatterns += patterns('', url(r'^reset_password_done/$', 'django.contrib.auth.views.password_reset_done', {'template_name': 'users/reset_password_done.html', 'extra_context': {'languages': LANGUAGES, }, }, name='password_reset_done'), )

urlpatterns += patterns('', url(r'^reset_password_confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', {'template_name': 'users/reset_password_confirm.html', 'extra_context': {'languages': LANGUAGES, }, }, name='password_reset_confirm'), )

urlpatterns += patterns('', url(r'^reset_password_complete/$', 'django.contrib.auth.views.password_reset_complete', {'template_name': 'users/reset_password_complete.html', 'extra_context': {'languages': LANGUAGES, }, }, name='reset_password_complete'), )

The reset password emali is sent, but the link in the email causes an error.

This is the link copied from the email sent to the user:

http://127.0.0.1:8000/reset_password_confirm/MQ/455-425cc3d8545fd75d4334/

When I place the url in my browser, I get the following error:

enter image description here

I just cannot see the error! I am hoping that someone can point out what I have done wrong.

EDIT

After I change the name='reset_password_complete' to name='password_reset_complete' I get the following error:

enter image description here

Any suggestions to solve this issue would be appreciated.


Solution

  • The url pattern must be named password_reset_complete. You currently have reset_password_complete.

    url(r'^reset_password_complete/$',
        'django.contrib.auth.views.password_reset_complete', 
        {
            'template_name': 'users/reset_password_complete.html', 
             'extra_context': {'languages': LANGUAGES, }, 
        }, 
        name='password_reset_complete',
    )