# ERR\_CONNECTION\_CLOSED after clicking on password reset link

**URL:** <https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492>\
**Category:** Using Django\
**Created:** [November 12, 2021, 8:42am UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492 "2021-11-12T08:42:43Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![vicrost](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vicrost/32/4837_2.png) [@vicrost](https://forum.djangoproject.com/u/vicrost)\
**Post date:** [November 12, 2021, 8:42am UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/1 "2021-11-12T08:42:44Z")

</div>

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](http://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?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 12, 2021, 3:53pm UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/2 "2021-11-12T15:53:56Z")

</div>

We’re probably going to need to see the _complete_ error message along with the URL being accessed to begin to diagnose something like this.

---

<div class="post-metadata">

**Author:** ![vicrost](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vicrost/32/4837_2.png) [@vicrost](https://forum.djangoproject.com/u/vicrost)\
**Post date:** [November 12, 2021, 9:17pm UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/3 "2021-11-12T21:17:14Z")

</div>

This is the URL being accessed:  
([https://isowservices.com/reset/MQ/aw0r09-1e98dfd21ed7341c8fceb30327610ff2/](https://isowservices.com/reset/MQ/aw0r09-1e98dfd21ed7341c8fceb30327610ff2/))

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/2/2e436f1dcd857ae2848c52d8fbcf5d6b8b4511c0.png)

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 12, 2021, 9:25pm UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/4 "2021-11-12T21:25:49Z")

</div>

Ok, so lets check this element by element:

- Do you have https set up? (Do other pages work across https?)

- Do you own [isowservices.com](http://isowservices.com)?

- Have you verified that your site works with any other path?

---

<div class="post-metadata">

**Author:** ![vicrost](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vicrost/32/4837_2.png) [@vicrost](https://forum.djangoproject.com/u/vicrost)\
**Post date:** [November 12, 2021, 10:56pm UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/5 "2021-11-12T22:56:22Z")

</div>

> [@KenWhitesell](#):
>
> Do you have https set up? (Do other pages work across https?)

Yes. The website is using the " Let’s Encrypt certificate". And also, the other pages work across https

> [@KenWhitesell](#):
>
> Do you own [isowservices.com](http://isowservices.com)?

Yes. I own the website and the domain name.

> [@KenWhitesell](#):
>
> Is it set up in DNS to point to your server?

Yes. I have PythonAnywere’s server CNAME set up in my domain settings in GoDaddy

> [@KenWhitesell](#):
>
> Have you verified that your site works with any other path?

I’m sorry. I don’t understand what you meant with this question

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 12, 2021, 11:02pm UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/6 "2021-11-12T23:02:55Z")

</div>

> [@vicrost](#):
>
> I’m sorry. I don’t understand what you meant with this question

You answered that earlier. The rest of your site is working aside from this.

Next thing to check then is the view. What is the view associated with this url? Is it a view you’ve written or one of the standard system views?

---

<div class="post-metadata">

**Author:** ![vicrost](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vicrost/32/4837_2.png) [@vicrost](https://forum.djangoproject.com/u/vicrost)\
**Post date:** [November 13, 2021, 12:10am UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/7 "2021-11-13T00:10:48Z")

</div>

The email template being used is from the standard system one.

```auto
{% 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.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 13, 2021, 12:26am UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/8 "2021-11-13T00:26:17Z")

</div>

Ok, but what is the view that is supposed to handle /reset/MQ/… urls? Is your urls.py file routing this URL correctly?

---

<div class="post-metadata">

**Author:** ![vicrost](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vicrost/32/4837_2.png) [@vicrost](https://forum.djangoproject.com/u/vicrost)\
**Post date:** [November 13, 2021, 12:28am UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/9 "2021-11-13T00:28:49Z")

</div>

It is the standard PasswordResetConfirmView

```auto
path("reset/<uidb64>/<token>/",auth_views.PasswordResetConfirmView.as_view(template_name="accounts/password_reset_form.html"),
name="password_reset_confirm"),

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 13, 2021, 12:30am UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/10 "2021-11-13T00:30:37Z")

</div>

> [@vicrost](#):
>
> `accounts/password_reset_form.html`

Is this your template or is it loading the standard system password reset template?

---

<div class="post-metadata">

**Author:** ![vicrost](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vicrost/32/4837_2.png) [@vicrost](https://forum.djangoproject.com/u/vicrost)\
**Post date:** [November 13, 2021, 12:32am UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/11 "2021-11-13T00:32:53Z")

</div>

Its my template.

```auto
{% extends 'home/base.html' %}
{% load static %}

{% block heading %}
    <style>
        body{
            background-color: #ebeff5;
        }
    </style>

{% endblock %}

{% block content %}

<section id="password_reset_form">
    <div class="container">
        <div class="password_reset_form_box">
            <div class="form_heading">
                <h1>Enter your new password</h1>
            </div>

            <p class="help_text">Please enter your new password twice so we can verify that you typed it in correctly.</p>

            <form method="post">
                {% csrf_token %}

                {% for non_field_error in form.non_field.errors %}
                    <p class="error_message">{{ non_field_error }}</p>
                {% endfor %}
                {% for field in form %}
                    <div class="field_wrapper">
                        {{field.label}}
                        {{field}}

                        {% for error in field.errors %}
                            <p class="error_message">{{error}}</p>
                        {% endfor %}

                    </div>
                {% endfor %}
                
                <button type="submit" class="success_btn"> Update Password</button>
                
            </form>
        </div>
    </div>
</section>
   

{% endblock %}

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 13, 2021, 1:01am UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/12 "2021-11-13T01:01:50Z")

</div>

First suggestion would be to remove the use of the custom template from the `as_view` call in the url. See if it works with the standard template.

---

<div class="post-metadata">

**Author:** ![vicrost](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vicrost/32/4837_2.png) [@vicrost](https://forum.djangoproject.com/u/vicrost)\
**Post date:** [November 13, 2021, 1:55am UTC](https://forum.djangoproject.com/t/err-connection-closed-after-clicking-on-password-reset-link/10492/13 "2021-11-13T01:55:17Z")

</div>

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.

```auto
http://isowservices.com/reset/Mg/aw1ww5-b0e3740e71dd4b97558591e10d0201c8/

```

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](http://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.

```auto
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}

```

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.
