简体   繁体   English

Django 重置密码:无效令牌

[英]Django reset password: invalid token

I have deployed my Django project on production and test password reset using Django authentication我已经使用 Django 身份验证在生产和测试密码重置上部署了我的 Django 项目

I receive an email with link but I got the message 'Invalid token' meaning that link is invalid我收到带有链接的 email 但收到消息“无效令牌”意味着链接无效

Settings.py设置.py

ALLOWED_HOSTS = ['192.xxx.xx.xx','http://example.com/','https://example.com/'] #example.com replace by my real domain
CSRF_COOKIE_SECURE = True
CSRF_TRUSTED_ORIGINS = ['example.com']

password_reset_email.html password_reset_email.html

Une demande de modification de mot de passe a été demandé par {{ email }}. 
Veuillez suivre ce lien :
{{ protocol}}://example.com{% url 'password_reset_confirm' uidb64=uid token=token %}


PS : Merci de ne pas répondre à cet email

If you are using CSRF_COOKIE_SECURE = True then your URL must be in https.如果您使用CSRF_COOKIE_SECURE = True那么您的 URL 必须在 https 中。

You can read more about it here .你可以在这里阅读更多关于它的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM