[Django] #32401: Email template for resetting password is missing the port the application is running on

14 views
Skip to first unread message

Django

unread,
Jan 31, 2021, 1:09:25 PM1/31/21
to django-...@googlegroups.com
#32401: Email template for resetting password is missing the port the application
is running on
-------------------------------------+-------------------------------------
Reporter: Bergiu | Owner: nobody
Type: Bug | Status: new
Component: | Version: 3.1
contrib.admin | Keywords: email template
Severity: Normal | reset
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
If the django application is running on a different port than 80 or 443
the email template for resetting the password sends the wrong link for the
confirmation.

I have installed dj-rest-auth and allauth. There are methods to reset the
password of an account. These methods use
django.contrib.auth.forms.PasswordResetForm and this sends an email to the
given email address with the template from
django/contrib/admin/templates/registration/password_reset_email.html.
There is no option in this template to set the port in the confirm
address.

For now i use a hack, where i put the port in the sites domain name, but i
think, there should be an option to set the port in this template:
https://github.com/django/django/blob/master/django/contrib/admin/templates/registration/password_reset_email.html#L6

--
Ticket URL: <https://code.djangoproject.com/ticket/32401>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 1, 2021, 6:54:45 AM2/1/21
to django-...@googlegroups.com
#32401: Email template for resetting password is missing the port the application
is running on
-------------------------------------+-------------------------------------
Reporter: Bergiu | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution: needsinfo
Keywords: email template | Triage Stage:
reset | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* cc: Florian Apolloner (added)
* status: new => closed
* resolution: => needsinfo


Comment:

> For now i use a hack, where i put the port in the sites domain name, but
i think, there should be an option to set the port in this template

That is not a hack, see the
[https://docs.djangoproject.com/en/dev/ref/contrib/sites/#get-current-
site-shortcut get_current_site() docs]. `Site.domain` should contain the
port if `django.contrib.sites` is installed and the current `Site` is set.
If not, a `RequestSite` object based on the request is returned.

Maybe your Web server isn't setting the `SERVER_PORT` header
appropriately? or, if you're using `HTTP_X_FORWARDED_PORT`, it's a
duplicate of #31354.

--
Ticket URL: <https://code.djangoproject.com/ticket/32401#comment:1>

Reply all
Reply to author
Forward
0 new messages