简体   繁体   中英

Django reset password: invalid token

I have deployed my Django project on production and test password reset using Django authentication

I receive an email with link but I got the message 'Invalid token' meaning that link is invalid

Settings.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

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.

You can read more about it here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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