NoReverseMatch exception while resetting password in django using django's default views

后端 未结 1 476
南旧
南旧 2021-01-16 00:44

I am getting the below error when I am using the \'ResetMyPassword\' button

Reverse for \'password_reset_confirm\' with arguments \'()\' and keyword argument         


        
相关标签:
1条回答
  • 2021-01-16 01:03

    Your password_reset_confirm URL pattern is out of date. It changed from uidb36 to uidb64 in Django 1.6. It should be:

    url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
    'django.contrib.auth.views.password_reset_confirm',
    name='password_reset_confirm'),
    

    Update your password reset email template as well:

    {% url 'password_reset_confirm' uidb64=uid token=token %}
    

    In Django 1.8+, you should use the view in your url pattern rather than the string.

    from django.contrib.auth.views import password_reset_confirm
    
    urlpatterns = [
        ...
        url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
        password_reset_confirm, name='password_reset_confirm'),
        ...
    ]
    

    Ensure that you

    0 讨论(0)
提交回复
热议问题