One of the users on my website wanted to reset their password but when they clicked on the link sent to their email, the password reset form page isn’t shown but rather an ERR_CONNECTION_CLOSED page.
So I tested this and also got the same results.
There are no errors shown on my website’s error logs in PythonAnywhere (hosting platform) and when I tried to check if the password reset was working locally, I was taken to a “not secure” page of Godaddy (my domain hosting platform) which says welcome to “mydomain.com”.
Since I couldn’t find any errors, I don’t know where to start on how to fix this issue or which part of my code I should show. What could be the problem?
As I mentioned before, there was no error message in the terminal when I tested this locally and no error message shown in the live website error logs. But this is a screenshot of the page shown on Microsoft Edge
The email template being used is from the standard system one.
{% load i18n %}{% autoescape off %}
{% blocktranslate %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktranslate %}
{% translate "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
{% translate 'Your username, in case you’ve forgotten:' %} {{ user.get_username }}
{% translate "Thanks for using our site!" %}
{% blocktranslate %}The {{ site_name }} team{% endblocktranslate %}
{% endautoescape %}
I have a view that sends a custom email to newly registered users so that they can set their passwords through a link but it shouldn’t affect the normal reset password workflow as it only activates when the register form is submitted.
Okay. I did what you suggested on localhost but then I get a blank page with this text “Not Found 404.0”.
Now I do want to mention that I’ve noticed that on localhost the url link in the password reset email uses my live website’s domain name instead of the localhost server name. This is the url shown on the reset email locally.
While I was setting up the custom welcome email for new users, I had to add my website’s domain name to the sites in the Django admin so that the {{site_name}} shown at the end of the default email template is not “example.com”. So I’m guessing that this is what is causing the default email template to use the sites domain name instead of the localhost.
Nonetheless, I had tested the password reset before on both local and live and it was working. And even if the sites issue is the culprit locally, it shouldn’t be a problem for the live version of the website, which is actually on the domain. So I don’t think the overarching issue here is the sites.