NoReverseMatch at / accounts / password / reset / confirm

I am using django userena and am getting an error. After sending the email address for the password reset, I get a reset confirmation email. The mail body is something like this

You're receiving this e-mail because you requested a password reset
for your user account at example.example.com.

Please go to the following page and choose a new password:

http://example.example.com/accounts/password/reset/confirm/Mg-3xm-add2c70e92d3694c5043/



Your username, in case you've forgotten: ****


Thanks for using our site!

Sincerely,
example.example.com

      

but after clicking the link to enter a new password, I get the following error

NoReverseMatch at /accounts/password/reset/confirm/Mg-3xm-add2c70e92d3694c5043/
Reverse for 'password_reset_complete' with arguments '()' and keyword arguments '{}' not    found. 0 pattern(s) tried: []
Request Method: GET
Request URL:    http://med.finder-lbs.com/accounts/password/reset/confirm/Mg-3xm-   add2c70e92d3694c5043/
Django Version: 1.6.1
Exception Type: NoReverseMatch
Exception Value:    
Reverse for 'password_reset_complete' with arguments '()' and keyword arguments '{}' not     found. 0 pattern(s) tried: []

      

urls.py

url(r'^resetpassword/passwordsent/$', 'django.contrib.auth.views.password_reset_done', name='password_reset_done'),
url(r'^password/reset/$',
   auth_views.password_reset,
   {'template_name': 'userena/password_reset_form.html',
    'email_template_name': 'userena/emails/password_reset_message.txt',
    'extra_context': {'without_usernames': userena_settings.USERENA_WITHOUT_USERNAMES}
    },
   name='userena_password_reset'),
url(r'^password/reset/done/$',
   auth_views.password_reset_done,
   {'template_name': 'userena/password_reset_done.html'},
   name='userena_password_reset_done'),
url(r'^user/password/reset/confirm/$',
         'django.contrib.auth.views.password_reset_confirm'),
url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$',
   auth_views.password_reset_confirm,
   {'template_name': 'userena/password_reset_confirm_form.html'},
   name='userena_password_reset_confirm'),

url(r'^password/reset/confirm/complete/$',
   auth_views.password_reset_complete,
   {'template_name': 'userena/password_reset_complete.html'}),

      

password_reset_message.txt

{% load i18n %}{% autoescape off %}{% load url from future %}
{% blocktrans %}You're receiving this e-mail because you,requested a password reset
for your user account at {{ site_name }}{% endblocktrans %}.

{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'userena_password_reset_confirm' uidb64=uid   token=token %}
{% endblock %}

{% if not without_usernames %}{% blocktrans with user.username as username %}
Your username, in case you've forgotten: {{ username }}
{% endblocktrans %}
{% endif %}
{% trans "Thanks for using our site!" %}

{% trans "Sincerely" %},
{{ site_name }}
{% endautoescape %}

      

I'm sure I'm missing something here, but I can't figure it out. I am using django 1.6

+3


source to share


1 answer


# urls.py
url(r'^password/reset/confirm/complete/$',
   auth_views.password_reset_complete,
   {'template_name': 'userena/password_reset_complete.html'},
   name='password_reset_complete') # must be named for reverse to work

      

Naming the url should solve your NoReverseMatch error.



However, it looks like you may have a different problem because you describe this error as occurring immediately after clicking the reset link, which means that the view is password_reset_confirm

trying to redirect the user to password_reset_complete

immediately - not after they have chosen a new password.

0


source







All Articles