1
votes

the link to password reset is not showing console output of password reset Hi there, Someone asked for a password reset for the email address [email protected], Follow the link below: http://127.0.0.1:8000 {% url 'password_reset_confirm' uidb64=uid token=token %}

HTML FILES

password_reset.html

<form action="" method="POST">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="send password reset email" name="submit" />
</form>

password_reset_email.html

   Hi there, Someone asked for a password reset for the email
   address {{ email }}, Follow the link below: {{ protocol }}://
  {{ domain}} {% url'password_reset_confirm' uidb64=uid token=token %} 

password_reset_confirm.html

<div>
{% if validlink %}
<h2>change password for 0{{ form.user.username }}</h2>
 <form action="" method="POST" novalidate>
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="changepassword" name="submit" />
</form>
{% else %}
<h3>Reset your password</h3>
<p>it looks like you clicked on an invalid passowrd reset link try again</p>
<a href="{% url 'password_reset' %}">Request</a>
{% endif %}
</div>

settings.py

EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"

acoounts/urls.py

path("accounts/", include("django.contrib.auth.urls")),
2
Could you edit your question to show the Python code that sends the email?Jaap Joris Vens

2 Answers

0
votes

Please check the following things.

{{ protocol }}://{{ domain}} {% url'password_reset_confirm' uidb64=uid token=token %} 
  • Remove the space between {{ domain}} {% url''}
  • Check that your email template is getting value for protocol and domain
  • Inspect in the email and check what is the final link is.
0
votes

I faced the same problem, all I had to do was put the code on the same line.

{{ protocol }}://{{ domain }}{% url "password_reset_confirm" uidb64=uid token=token %}
  1. Make sure the code is not broken into a new line.