Reputation: 673
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
Upvotes: 0
Views: 514
Reputation: 2383
If you are using CSRF_COOKIE_SECURE = True
then your URL must be in https.
You can read more about it here.
Upvotes: 1