Opened 3 years ago

Closed 3 years ago

#33687 closed New feature (wontfix)

Add option to set unusable password to changepassword

Reported by: Vlastimil Zíma Owned by: nobody
Component: contrib.auth Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I just found out, there is no way to set unusable password for a user using a command changepassword. It's sometimes needed to disable password authentication, e.g. for robot accounts which use third party authentication systems and similar cases. I suggest to add an option, e.g. --set-unusable-password to the changepassword command which would allow this.

Change History (1)

comment:1 by Mariusz Felisiak, 3 years ago

Resolution: wontfix
Status: newclosed

Thanks for this ticket, however the changepassword command was never intended to cover all available options. You can create a custom command in your project or use a small standalone script instead:

UserModel = get_user_model()
user = UserModel._default_manager.db_manager('default').get(username=username)
user.set_password(new_password)
user.set_unusable_password()
user.save()
Note: See TracTickets for help on using tickets.
Back to Top