[Django] #27515: admin login action is maxlength 254 rether thet 150 characters

92 views
Skip to first unread message

Django

unread,
Nov 20, 2016, 9:32:05 AM11/20/16
to django-...@googlegroups.com
#27515: admin login action is maxlength 254 rether thet 150 characters
------------------------------------------------+------------------------
Reporter: Ramin Farajpour Cami | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Forms | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
Hi,

http://127.0.0.1:8000/admin/


{{{
<form action="/admin/" method="post" id="login-form">
<input type="hidden" name="csrfmiddlewaretoken" value="">
<div class="form-row">
<label class="required" for="id_username">Username:</label>
<input autofocus="" id="id_username" maxlength="254" name="username"
type="text" required="">
}}}

`maxlength="150"` is Right,

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

Django

unread,
Nov 20, 2016, 9:32:12 AM11/20/16
to django-...@googlegroups.com
#27515: admin login action is maxlength 254 rether thet 150 characters
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Ramin
Cami | Farajpour Cami
Type: | Status: assigned
Cleanup/optimization |
Component: Forms | Version: 1.10
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ramin Farajpour Cami):

* status: new => assigned
* owner: nobody => Ramin Farajpour Cami


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

Django

unread,
Nov 20, 2016, 10:14:30 AM11/20/16
to django-...@googlegroups.com
#27515: admin login action is maxlength 254 rether thet 150 characters
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Ramin
Cami | Farajpour Cami
Type: | Status: assigned
Cleanup/optimization |
Component: Forms | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ramin Farajpour Cami):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:2>

Django

unread,
Nov 20, 2016, 10:15:04 AM11/20/16
to django-...@googlegroups.com
#27515: admin login action is maxlength 254 rether thet 150 characters
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Ramin
Cami | Farajpour Cami
Type: | Status: assigned
Cleanup/optimization |
Component: Forms | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ramin Farajpour Cami):

* Attachment "fix.patch" added.

Django

unread,
Nov 20, 2016, 10:35:00 AM11/20/16
to django-...@googlegroups.com
#27515: admin login action is maxlength 254 rather than 150 characters

-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Ramin
Cami | Farajpour Cami
Type: | Status: assigned
Cleanup/optimization |
Component: Forms | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:3>

Django

unread,
Nov 20, 2016, 11:38:35 AM11/20/16
to django-...@googlegroups.com
#27515: admin login action is maxlength 254 rather than 150 characters
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Ramin
Cami | Farajpour Cami
Type: | Status: assigned
Cleanup/optimization |
Component: Forms | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

The suggestion doesn't account for custom user models and undoes #19130
(you might try using `git blame` to investigate history next time).

If the current situation is problematic for you, perhaps there would be
some value in setting the max length based on the custom user model
[https://github.com/django/django/commit/bfcda778#commitcomment-2001360 as
Claude suggested] .

--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:4>

Django

unread,
Nov 20, 2016, 12:02:15 PM11/20/16
to django-...@googlegroups.com
#27515: admin login action is maxlength 254 rather than 150 characters
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Ramin
Cami | Farajpour Cami
Type: | Status: assigned
Cleanup/optimization |
Component: Forms | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Ramin Farajpour Cami):

User model use max_length=150,also in add user form set 150,
What your means "value setting the max length based on the custom user
model"?

--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:5>

Django

unread,
Nov 20, 2016, 6:51:44 PM11/20/16
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model

-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Ramin
Cami | Farajpour Cami
Type: | Status: closed
Cleanup/optimization |
Component: contrib.auth | Version: 1.10
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: assigned => closed
* component: Forms => contrib.auth
* has_patch: 1 => 0
* resolution: => invalid
* stage: Unreviewed => Accepted


Comment:

[https://docs.djangoproject.com/en/stable/topics/auth/customizing/#specifying-a
-custom-user-model Custom user models] may have a username with length
other than 150, that's why using that value isn't appropriate. We might be
able to use that with something like this:
`self.fields['username'].max_length =
UserModel._meta.get_field(UserModel.USERNAME_FIELD).max_length`.

--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:6>

Django

unread,
Nov 20, 2016, 7:35:00 PM11/20/16
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Ramin
Cami | Farajpour Cami
Type: | Status: new

Cleanup/optimization |
Component: contrib.auth | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: closed => new
* resolution: invalid =>


Old description:

> Hi,
>
> http://127.0.0.1:8000/admin/
>

> {{{
> <form action="/admin/" method="post" id="login-form">
> <input type="hidden" name="csrfmiddlewaretoken" value="">
> <div class="form-row">
> <label class="required" for="id_username">Username:</label>
> <input autofocus="" id="id_username" maxlength="254" name="username"
> type="text" required="">
> }}}
>
> `maxlength="150"` is Right,

New description:

`AuthenticationForm` has a hardcoded `max_length=254` (#19130). It might
be able to use the max length from the user model with something like:
`self.fields['username'].max_length =
UserModel._meta.get_field(UserModel.USERNAME_FIELD).max_length` in
`AuthenticationForm.__init__()`.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:7>

Django

unread,
Nov 22, 2016, 12:52:07 AM11/22/16
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Ramin
Cami | Farajpour Cami
Type: | Status: new
Cleanup/optimization |
Component: contrib.auth | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ramin Farajpour Cami):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/7592 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:8>

Django

unread,
Nov 22, 2016, 8:32:38 AM11/22/16
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Ramin
Cami | Farajpour Cami
Type: | Status: new
Cleanup/optimization |
Component: contrib.auth | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:9>

Django

unread,
Dec 20, 2016, 7:03:47 PM12/20/16
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Ramin
Cami | Farajpour Cami
Type: | Status: new
Cleanup/optimization |
Component: contrib.auth | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Andrey Kuzminov):

Can I take this ticket or is it still Ramin's?

--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:10>

Django

unread,
Dec 20, 2016, 7:22:25 PM12/20/16
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Ramin
Cami | Farajpour Cami
Type: | Status: new
Cleanup/optimization |
Component: contrib.auth | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Ramin Farajpour Cami):

Yes, please assign to you

--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:11>

Django

unread,
Dec 22, 2016, 5:23:56 PM12/22/16
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Andrey
Cami | Kuzminov
Type: | Status: assigned

Cleanup/optimization |
Component: contrib.auth | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Andrey Kuzminov):

* owner: Ramin Farajpour Cami => Andrey Kuzminov


* status: new => assigned

* cc: Andrey Kuzminov (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:12>

Django

unread,
Aug 17, 2017, 2:41:52 PM8/17/17
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Lucas
Cami | Connors

Type: | Status: assigned
Cleanup/optimization |
Component: contrib.auth | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Lucas Connors):

* owner: Andrey Kuzminov => Lucas Connors


--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:13>

Django

unread,
Aug 18, 2017, 1:34:11 AM8/18/17
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Lucas
Cami | Connors
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.auth | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Lucas Connors):

* needs_better_patch: 1 => 0


* has_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:14>

Django

unread,
Aug 18, 2017, 1:34:31 AM8/18/17
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Lucas
Cami | Connors
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.auth | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:15>

Django

unread,
Aug 18, 2017, 1:37:29 AM8/18/17
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Lucas
Cami | Connors
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.auth | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Lucas Connors):

Sorry for the spam. I thought unchecking and rechecking would
automatically find the PR on Github. This is it here:
https://github.com/django/django/pull/8925

--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:16>

Django

unread,
Aug 29, 2017, 2:32:28 PM8/29/17
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Lucas
Cami | Connors
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

* version: 1.10 => master
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:17>

Django

unread,
Sep 1, 2017, 10:20:12 AM9/1/17
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Lucas
Cami | Connors
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1

* stage: Ready for checkin => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:18>

Django

unread,
Oct 9, 2017, 12:23:12 PM10/9/17
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Lucas
Cami | Connors
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:19>

Django

unread,
Oct 20, 2017, 11:12:14 AM10/20/17
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Lucas
Cami | Connors
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"d2333912085fc3bd827295f2bc8253d6723c242b" d2333912]:
{{{
#!CommitTicketReference repository=""
revision="d2333912085fc3bd827295f2bc8253d6723c242b"
Refs #19130 -- Added a test for AuthenticationForm.username max_length.

This will be a more useful regression test after refs #27515.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:20>

Django

unread,
Oct 20, 2017, 11:34:08 AM10/20/17
to django-...@googlegroups.com
#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
Reporter: Ramin Farajpour | Owner: Lucas
Cami | Connors
Type: | Status: closed

Cleanup/optimization |
Component: contrib.auth | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed

* resolution: => fixed


Comment:

In [changeset:"5ceaf14686ce626404afb6a5fbd3d8286410bf13" 5ceaf146]:
{{{
#!CommitTicketReference repository=""
revision="5ceaf14686ce626404afb6a5fbd3d8286410bf13"
Fixed #27515 -- Made AuthenticationForm's username field use the
max_length from the model field.

Thanks Ramin Farajpour Cami for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:21>

Reply all
Reply to author
Forward
0 new messages