1

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 root@gmail.com, 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")),

3 Answers3

0

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.
Ajay saini
  • 2,352
  • 1
  • 11
  • 25
  • I've inspected the link in the email. How do I make sure that the correct `domain` is returned? Instead of `www` before the domain, my link contains `url5914`. @Ajay-saini – Jakob Oct 14 '21 at 08:50
0

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

http://127.0.0.1:8000/accounts/password_reset/ Try this you just have to add the URL which is link to login .

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/30590593) – Sercan Dec 18 '21 at 00:39