[Django] #33296: Allow manage.py changepassword to use DJANGO_SUPERUSER_PASSWORD

4 views
Skip to first unread message

Django

unread,
Nov 17, 2021, 7:05:15 AM11/17/21
to django-...@googlegroups.com
#33296: Allow manage.py changepassword to use DJANGO_SUPERUSER_PASSWORD
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
johnthagen |
Type: New | Status: new
feature |
Component: | Version: 3.2
contrib.auth | Keywords: django-admin
Severity: Normal | changepassword
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The `createsuperuser` admin command can use a `DJANGO_SUPERUSER_PASSWORD`
environment variable to set the password. This is very useful for
automated/unattended installations as well as running Django within Docker
where it is simpler to pass data into the container using environment
variables.

https://docs.djangoproject.com/en/3.2/ref/django-admin/#createsuperuser

The `changepassword` admin command is used in a very similar way. It would
be helpful if this command also provided a `--no-input` variant that would
read from the `DJANGO_SUPERUSER_PASSWORD` environment variable and change
a users password without interactively prompting for input.

https://docs.djangoproject.com/en/3.2/ref/django-admin/#changepassword

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

Django

unread,
Nov 17, 2021, 7:40:35 AM11/17/21
to django-...@googlegroups.com
#33296: Allow manage.py changepassword to use DJANGO_SUPERUSER_PASSWORD
-------------------------------------+-------------------------------------
Reporter: johnthagen | Owner: nobody
Type: New feature | Status: closed
Component: contrib.auth | Version: 3.2
Severity: Normal | Resolution: wontfix
Keywords: django-admin | Triage Stage:
changepassword | Unreviewed
Has patch: 0 | Needs documentation: 0

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

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


Comment:

Thanks for this ticket, however I'm skeptical. We've already had doubts
about using `DJANGO_SUPERUSER_PASSWORD` in the `createsuperuser`, see
#27801. In the end we accepted #27801 because creating a new superuser can
be complicated which is not the case in changing a password. You can
create a custom command in your project or use a small standalone script:
{{{
UserModel = get_user_model()
user =
UserModel._default_manager.db_manager('default').get(username=username)
user.set_password(new_password)
}}}

Please first start a discussion on the DevelopersMailingList, where you'll
reach a wider audience and see what other think, and
[https://docs.djangoproject.com/en/stable/internals/contributing/bugs-and-
features/#requesting-features follow the guidelines with regards to
requesting features].

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

Django

unread,
Mar 14, 2022, 2:32:38 PM3/14/22
to django-...@googlegroups.com
#33296: Allow manage.py changepassword to use DJANGO_SUPERUSER_PASSWORD
-------------------------------------+-------------------------------------
Reporter: johnthagen | Owner: nobody
Type: New feature | Status: closed
Component: contrib.auth | Version: 3.2
Severity: Normal | Resolution: wontfix
Keywords: django-admin | Triage Stage:
changepassword | Unreviewed
Has patch: 0 | Needs documentation: 0

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

Comment (by johnthagen):

Thank you for the script example. For those that use this as a reference,
you will also need to add the following line to the end of the script from
Mariusz Felisiak:

{{{
user.save()
}}}

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

Reply all
Reply to author
Forward
0 new messages