【发布时间】:2013-12-17 15:15:38
【问题描述】:
我无法让 password_reset_confirm 正常工作。我查看了许多解决方案,但似乎没有一个对我有用。
urls.py:(特别是第三行)
(r'^resetpassword/passwordsent/$', 'django.contrib.auth.views.password_reset_done', name="reset_password"),
(r'^resetpassword/$', 'django.contrib.auth.views.password_reset', name="reset_password"),
(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)-(?P<token>,+)/$', 'django.contrib.auth.views.password_reset_confirm'),
(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
password_reset_email.html:
{% load url from future %}
{% autoescape off %}
Someone asked for password reset for email {{ email }}. Follow the link below:
{{ protocol}}://{{ domain }}{% url 'django.contrib.auth.views.password_reset_confirm' uidb64=uid token=token %}
{% endautoescape %}
一切似乎都正常,直到我提交电子邮件并收到以下错误:
Reverse for 'django.contrib.auth.views.password_reset_confirm' with arguments '()' and keyword arguments '{u'uidb64': 'OQ', u'token': u'3n2-0fee9d3f98dad36e63d8'}' not found. 2 pattern(s) tried: ['/$reset/(?P<uidb64>[0-9A-Za-z_\\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', 'reset/(?P<uidb64>[0-9A-Za-z_\\-]+)-(?P<token>,+)/$']
我正在使用 Django 1.6。 任何帮助深表感谢!谢谢!
【问题讨论】:
-
你看过this suspiciously similar的问题吗?
-
使用视图的名称或全名。
-
是的,我有,我将我的 url conf 更改为完整路径,但它仍然没有为我工作。
标签: python django passwords reset