Django密码重置卡在循环中

时间:2012-10-14 20:17:54

标签: django authentication

我正在尝试将用户注册系统添加到我的Django站点。显然,我想使用内置的身份验证视图和表单。我将要实现auth密码重置过程。它可以正常发送电子邮件,但不会正确重定向。最终结果是密码重置完成的电子邮件被反复发送。我正在覆盖模板,但没有别的,现在他们只有:

{{form.As_p}}

我已将urls.py更改为使用auth.views

from django.contrib.auth import views as auth_views

(r'^account/forgot/$',
 auth_views.password_reset, 
 {'template_name': 'registration/password_reset.html',
  'post_reset_redirect':'/account/password-reset-done'}
),
(r'^account/password-reset-done/$',
 auth_views.password_reset_done,
 {'template_name': 'registration/password_reset_done.html'}
),

1 个答案:

答案 0 :(得分:1)

在我看来,好像你需要post_reset_redirect网址上的尾部斜杠。你试过吗?目前,/account/password-reset-doner'^account/password-reset-done/$'不匹配,因为/是强制性的。

请参阅Django url调度程序文档中的示例请求4:https://docs.djangoproject.com/en/dev/topics/http/urls/#example