However, this functionality is not available from the admin UI. When
creating a user or changing the password I am forced to enter a password.
I propose to make the password fields optional in the Admin UI and set an
unusable password if they are blank.
I am sorry if this has been discussed before. I looked before posting this
but could not find anything.
--
Ticket URL: <https://code.djangoproject.com/ticket/34429>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* version: 4.1 => dev
* stage: Unreviewed => Accepted
Comment:
Thanks for the ticket. I agree that it would nice to add an option to
create users with an unusable password in the admin, however, any implicit
logic can be confusing here (see
[https://code.djangoproject.com/ticket/4170#comment:4 comment]).
Therefore, I'm not in favor of your proposal to:
> ''... make the password fields optional in the Admin UI and set an
unusable password if they are blank.''
Maybe a checkbox in the "Add user" form e.g. ''"Usable password"''
(checked by default) that would hide password fields when unchecked 🤔, or
sth similar.
Tentatively accepted.
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:1>
* cc: Carlton Gibson, Sarah Boyce (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:2>
* owner: nobody => Sahilll15
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:3>
Comment (by Sahilll15):
i am starting to work on the project
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:4>
* owner: SAHIL SANJAY CHALKE => fsbraun
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:5>
Comment (by Fabian Braun):
Have a working solution. Will add tests and create a PR.
The checkbox field is called "Allow login" to clearly indicate that users
w/o password will not be able to log in. Please let me know if "Usable
password" is deemed a better label.
The password fields are only visible and validated if the checkbox is set.
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:6>
* has_patch: 0 => 1
Old description:
> Django allows to have user accounts with unusable passwords, either
> because authentication uses a different mechanism (e.g. LDAP) or because
> the User object is still needed (e.g. because it is referenced by a
> ForeignKey) but the user should no longer be allowed to log in.
>
> However, this functionality is not available from the admin UI. When
> creating a user or changing the password I am forced to enter a password.
>
> I propose to make the password fields optional in the Admin UI and set an
> unusable password if they are blank.
>
> I am sorry if this has been discussed before. I looked before posting
> this but could not find anything.
New description:
Django allows to have user accounts with unusable passwords, either
because authentication uses a different mechanism (e.g. LDAP) or because
the User object is still needed (e.g. because it is referenced by a
ForeignKey) but the user should no longer be allowed to log in.
However, this functionality is not available from the admin UI. When
creating a user or changing the password I am forced to enter a password.
I propose to make the password fields optional in the Admin UI and set an
unusable password if they are blank.
I am sorry if this has been discussed before. I looked before posting this
but could not find anything.
[https://github.com/django/django/pull/16942 PR]
--
Comment:
Patch here: https://github.com/django/django/pull/16942
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:7>
* needs_better_patch: 0 => 1
* needs_docs: 0 => 1
Comment:
[https://github.com/django/django/pull/16942 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:8>
* needs_better_patch: 1 => 0
* needs_docs: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:9>
* ui_ux: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:10>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:11>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:12>
* needs_better_patch: 0 => 1
Comment:
Made many rounds of reviews, including a great conversation about UX of
this feature
([https://discord.com/channels/856567261900832808/859997770274045954/1174701788000178217
see Discord chat]).
--
Ticket URL: <https://code.djangoproject.com/ticket/34429#comment:13>