#33296 closed New feature (wontfix)
Allow manage.py changepassword to use DJANGO_SUPERUSER_PASSWORD
| Reported by: | johnthagen | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.auth | Version: | 3.2 |
| Severity: | Normal | Keywords: | django-admin changepassword |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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
Change History (2)
comment:1 by , 4 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
comment:2 by , 4 years ago
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()
Thanks for this ticket, however I'm skeptical. We've already had doubts about using
DJANGO_SUPERUSER_PASSWORDin thecreatesuperuser, 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 follow the guidelines with regards to requesting features.