Re: [Django] #35678: BaseUserCreationForm should not have the admin-specific usable_password field

15 views
Skip to first unread message

Django

unread,
Aug 14, 2024, 2:04:40 AM8/14/24
to django-...@googlegroups.com
#35678: BaseUserCreationForm should not have the admin-specific usable_password
field
---------------------------------+------------------------------------
Reporter: Simon Willison | Owner: (none)
Type: Bug | Status: new
Component: contrib.auth | Version: 5.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Comment (by James Bennett):

Forum discussion: https://forum.djangoproject.com/t/the-purpose-of-
usercreationform/33836
--
Ticket URL: <https://code.djangoproject.com/ticket/35678#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 14, 2024, 12:17:42 PM8/14/24
to django-...@googlegroups.com
#35678: BaseUserCreationForm should not have the admin-specific usable_password
field
-------------------------------------+-------------------------------------
Reporter: Simon Willison | Owner: Natalia
| Bidart
Type: Bug | Status: assigned
Component: contrib.auth | Version: 5.1
Severity: Release blocker | 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 Natalia Bidart):

* owner: (none) => Natalia Bidart
* status: new => assigned

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

Django

unread,
Aug 14, 2024, 3:28:46 PM8/14/24
to django-...@googlegroups.com
#35678: BaseUserCreationForm should not have the admin-specific usable_password
field
---------------------------------+----------------------------------------
Reporter: Simon Willison | Owner: Fabian Braun
Type: Bug | Status: assigned
Component: contrib.auth | Version: 5.1
Severity: Release blocker | 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 Fabian Braun):

* cc: Fabian Braun (added)
* has_patch: 0 => 1
* owner: Natalia Bidart => Fabian Braun

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

Django

unread,
Aug 14, 2024, 3:52:22 PM8/14/24
to django-...@googlegroups.com
#35678: BaseUserCreationForm should not have the admin-specific usable_password
field
---------------------------------+----------------------------------------
Reporter: Simon Willison | Owner: Fabian Braun
Type: Bug | Status: assigned
Component: contrib.auth | Version: 5.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+----------------------------------------
Changes (by Natalia Bidart):

* needs_docs: 0 => 1

Comment:

Fabian has started a draft PR and so did I when I assigned the ticket to
myself this morning. I think we want to keep the unusable password
functionality from the `AdminPasswordChangeForm`, so I believe we should
follow the approach from [https://github.com/django/django/pull/18484/ PR
18484].

Both PRs needs docs updates.
--
Ticket URL: <https://code.djangoproject.com/ticket/35678#comment:5>

Django

unread,
Aug 15, 2024, 9:49:09 AM8/15/24
to django-...@googlegroups.com
#35678: BaseUserCreationForm should not have the admin-specific usable_password
field
-------------------------------------+-------------------------------------
Reporter: Simon Willison | Owner: Natalia
| Bidart
Type: Bug | Status: assigned
Component: contrib.auth | Version: 5.1
Severity: Release blocker | 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 Natalia Bidart):

* needs_docs: 1 => 0
* owner: Fabian Braun => Natalia Bidart

Comment:

[https://github.com/django/django/pull/18484 PR] is ready for review,
Fabian and I agreed on closing the other one.
--
Ticket URL: <https://code.djangoproject.com/ticket/35678#comment:6>

Django

unread,
Aug 16, 2024, 1:38:45 AM8/16/24
to django-...@googlegroups.com
#35678: BaseUserCreationForm should not have the admin-specific usable_password
field
-------------------------------------+-------------------------------------
Reporter: Simon Willison | Owner: Natalia
| Bidart
Type: Bug | Status: assigned
Component: contrib.auth | Version: 5.1
Severity: Release blocker | 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 Carlton Gibson):

Just worth copying here from the Forum thread,
[https://forum.djangoproject.com/t/the-purpose-of-usercreationform/33836/8
a workaround for the very short term]:

> I ran into this and quickly added to following my subclass.
>
>
> {{{
> # Remove the option to create an account with an unusable password.
> usable_password = None
> }}}

Hopefully that saves someone a cycle.
--
Ticket URL: <https://code.djangoproject.com/ticket/35678#comment:7>

Django

unread,
Aug 19, 2024, 10:57:42 AM8/19/24
to django-...@googlegroups.com
#35678: BaseUserCreationForm should not have the admin-specific usable_password
field
-------------------------------------+-------------------------------------
Reporter: Simon Willison | Owner: Natalia
| Bidart
Type: Bug | Status: assigned
Component: contrib.auth | Version: 5.1
Severity: Release blocker | 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 Sarah Boyce):

* stage: Accepted => Ready for checkin

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

Django

unread,
Aug 19, 2024, 11:40:11 AM8/19/24
to django-...@googlegroups.com
#35678: BaseUserCreationForm should not have the admin-specific usable_password
field
-------------------------------------+-------------------------------------
Reporter: Simon Willison | Owner: Natalia
| Bidart
Type: Bug | Status: closed
Component: contrib.auth | Version: 5.1
Severity: Release blocker | Resolution: fixed
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 nessita <124304+nessita@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"0ebed5fa95f53b87383901bbd9341ef3c974344f" 0ebed5f]:
{{{#!CommitTicketReference repository=""
revision="0ebed5fa95f53b87383901bbd9341ef3c974344f"
Fixed #35678 -- Removed "usable_password" field from BaseUserCreationForm.

Refs #34429: Following the implementation allowing the setting of
unusable passwords via the admin site, the `BaseUserCreationForm` and
`UserCreationForm` were extended to include a new field for choosing
whether password-based authentication for the new user should be enabled
or disabled at creation time.
Given that these forms are designed to be extended when implementing
custom user models, this branch ensures that this new field is moved to
a new, admin-dedicated, user creation form `AdminUserCreationForm`.

Regression in e626716c28b6286f8cf0f8174077f3d2244f3eb3.

Thanks Simon Willison for the report, Fabian Braun and Sarah Boyce for
the review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35678#comment:10>

Django

unread,
Aug 19, 2024, 11:40:11 AM8/19/24
to django-...@googlegroups.com
#35678: BaseUserCreationForm should not have the admin-specific usable_password
field
-------------------------------------+-------------------------------------
Reporter: Simon Willison | Owner: Natalia
| Bidart
Type: Bug | Status: assigned
Component: contrib.auth | Version: 5.1
Severity: Release blocker | 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
-------------------------------------+-------------------------------------
Comment (by nessita <124304+nessita@…>):

In [changeset:"b60fd8722f305ec29c87f34d3fea262e56394ebd" b60fd87]:
{{{#!CommitTicketReference repository=""
revision="b60fd8722f305ec29c87f34d3fea262e56394ebd"
Refs #35678 -- Split tests for BaseUserCreationForm when using a custom
User model.

This work also allows to subclass BaseUserCreationFormTest to reuse the
tests and assertions for testing forms that extend BaseUserCreationForm,
which is now used for UserCreationFormTest, increasing its coverage.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35678#comment:9>

Django

unread,
Aug 19, 2024, 11:41:54 AM8/19/24
to django-...@googlegroups.com
#35678: BaseUserCreationForm should not have the admin-specific usable_password
field
-------------------------------------+-------------------------------------
Reporter: Simon Willison | Owner: Natalia
| Bidart
Type: Bug | Status: closed
Component: contrib.auth | Version: 5.1
Severity: Release blocker | Resolution: fixed
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
-------------------------------------+-------------------------------------
Comment (by Natalia <124304+nessita@…>):

In [changeset:"da22e6cb3cdb51f2f7ca45e1591d2c6a8be458e0" da22e6cb]:
{{{#!CommitTicketReference repository=""
revision="da22e6cb3cdb51f2f7ca45e1591d2c6a8be458e0"
[5.1.x] Fixed #35678 -- Removed "usable_password" field from
BaseUserCreationForm.

Refs #34429: Following the implementation allowing the setting of
unusable passwords via the admin site, the `BaseUserCreationForm` and
`UserCreationForm` were extended to include a new field for choosing
whether password-based authentication for the new user should be enabled
or disabled at creation time.
Given that these forms are designed to be extended when implementing
custom user models, this branch ensures that this new field is moved to
a new, admin-dedicated, user creation form `AdminUserCreationForm`.

Regression in e626716c28b6286f8cf0f8174077f3d2244f3eb3.

Thanks Simon Willison for the report, Fabian Braun and Sarah Boyce for
the review.

Backport of 0ebed5fa95f53b87383901bbd9341ef3c974344f from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35678#comment:12>

Django

unread,
Aug 19, 2024, 11:41:54 AM8/19/24
to django-...@googlegroups.com
#35678: BaseUserCreationForm should not have the admin-specific usable_password
field
-------------------------------------+-------------------------------------
Reporter: Simon Willison | Owner: Natalia
| Bidart
Type: Bug | Status: closed
Component: contrib.auth | Version: 5.1
Severity: Release blocker | Resolution: fixed
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
-------------------------------------+-------------------------------------
Comment (by Natalia <124304+nessita@…>):

In [changeset:"cfad0655c235ec532b40841d634b0f97e6280a4e" cfad0655]:
{{{#!CommitTicketReference repository=""
revision="cfad0655c235ec532b40841d634b0f97e6280a4e"
[5.1.x] Refs #35678 -- Split tests for BaseUserCreationForm when using a
custom User model.

This work also allows to subclass BaseUserCreationFormTest to reuse the
tests and assertions for testing forms that extend BaseUserCreationForm,
which is now used for UserCreationFormTest, increasing its coverage.

Backport of b60fd8722f305ec29c87f34d3fea262e56394ebd from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35678#comment:11>
Reply all
Reply to author
Forward
0 new messages