Django忘记密码功能更改默认电子邮件

时间:2011-08-04 10:12:14

标签: python django email passwords reset

我使用Django中内置的password_reset函数为我的网站创建了Forgot Password功能 它会发送如下的电子邮件:

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

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

http://example.com/reset/3/2zf-fe162b1d79f1b85c3630/

Your username, in case you've forgotten: Angie

Thanks for using our site!

The example.com team

我会在哪里更改此电子邮件?

2 个答案:

答案 0 :(得分:6)

该电子邮件的默认模板为django/contrib/admin/templates/registration/password_reset_email.html。您可以像往常一样在顶级应用目录中提供自己的模板templates/registration/password_reset_email.html来覆盖它。

答案 1 :(得分:0)

对于那些得到错误的人:

Caught NoReverseMatch while rendering: for line {% url 'views.cust_password_reset_confirm' uidb36=uid token=token %}

尝试发送重置密码时,请注意password_reset_confirm网址。它应该是这样的:

(r'^password-reset-confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$','django.contrib.auth.views.password_reset_confirm', {'template_name':'accounts/password_reset_confirm.html', 'post_reset_redirect':'/accounts/logout/'}),
相关问题