I created a Forgot Password functionality for my website using the password_reset function that is built in Django it sends an email like so:
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
Th开发者_JAVA百科anks for using our site!
The example.com team
Where would I change this email?
The default template for that email is django/contrib/admin/templates/registration/password_reset_email.html
. You can override it by providing your own template templates/registration/password_reset_email.html
in your top app directory as usual.
For those who get the error:
Caught NoReverseMatch while rendering: for line {% url 'views.cust_password_reset_confirm' uidb36=uid token=token %}
when trying to send the reset password email, watch out the password_reset_confirm url. It should be something like:
(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/'}),
精彩评论