Opened 18 years ago
Closed 16 years ago
#6273 closed (fixed)
Support for passwd-like password changing
| Reported by: | Ludvig Ericson | Owned by: | Justin Lilly |
|---|---|---|---|
| Component: | Core (Management commands) | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | justinlilly@… | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | yes | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I wrote a short command handler for management to change the password of the current user, or a given user, just like passwd.
Attachments (4)
Change History (18)
by , 18 years ago
| Attachment: | django-passwd.diff added |
|---|
comment:1 by , 18 years ago
| Owner: | changed from to |
|---|---|
| Patch needs improvement: | set |
| Status: | new → assigned |
comment:2 by , 18 years ago
| Owner: | changed from to |
|---|---|
| Status: | assigned → new |
Ack, I didn't mean to accept the ticket -- hopefully toxik will be able to code up the patch.
comment:3 by , 18 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
by , 18 years ago
| Attachment: | django_auth_passwd_command.diff added |
|---|
comment:4 by , 18 years ago
Okay, sorry for the delay, but I fixed it. Works for me, but I had to make management.py a package, so I don't know if that has any side-effects. (Moved it to ./management/__init__.py, should be fine I suppose.)
Also note that you want to delete the old management.py file since I doubt the patch will do that.
comment:5 by , 18 years ago
Oh and I changed the command a lil' bit, now it aborts if any of the two inputs are empty rather than if any are empty after both have been answered.
Also I'd like to post this svn st so as to clarify what I meant:
D django/contrib/auth/management.py A django/contrib/auth/management A django/contrib/auth/management/commands A django/contrib/auth/management/commands/__init__.py A django/contrib/auth/management/commands/passwd.py A django/contrib/auth/management/__init__.py
by , 17 years ago
| Attachment: | 6273_django_auth_passwd_command_r2.diff added |
|---|
Applies cleanly to r9478 -- Removed all changes except passwd.py which works.
comment:6 by , 17 years ago
| Cc: | added |
|---|
comment:7 by , 17 years ago
This functionality is available via django-command-extensions http://code.google.com/p/django-command-extensions/ Not sure if it should be wontfix'd as its available as a 3rd party app, especially since adrian was in favor. That being said, adrian was in favor before django-command-extensions existed. Hopefully someone with a better grasp on this stuff can decide?
comment:8 by , 17 years ago
Well, it's in django-command-extensions because I put it there. :-)
I think something like this should be available so that you don't have to force system administrators to either update a user's password using a Python shell or by means of the admin.
As an aside, would you (justinlilly) care to maintain this one? It'd be nice as I don't have the time over that I used to, what with the real world and that.
comment:10 by , 17 years ago
| Needs documentation: | set |
|---|---|
| Needs tests: | set |
Before this can go in:
passwdis a bit inside-baseball-y. Is there something wrong withchange_password?- Needs documentation.
- Needs tests.
by , 16 years ago
| Attachment: | 6273_change_password_auth_command.diff added |
|---|
Now with docs and renamed to change_password
comment:11 by , 16 years ago
| Needs documentation: | unset |
|---|
Added docs and changed passwd to change_password. Will need to do some more digging on the proper way to test these sorts of scripts.
comment:12 by , 16 years ago
| Needs tests: | unset |
|---|---|
| Patch needs improvement: | unset |
Russel has given me special dispensation for making this patch a "manual test" due to the complications for testing it. Should be ready for review, then check in.
comment:13 by , 16 years ago
| Needs tests: | set |
|---|
It's not that complicated: monkeypatch the _get_pass method in your tests to return what you want without prompting.
comment:14 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
This is a good idea, but a key improvement needs to be made before we can check it in. Because Django's auth system is technically a contrib app, this command should live in the
django/contrib/authdirectory. The advantages of this are that it won't clutter the django-admin.py command namespace if the auth app isn't installed, and it keeps all of the auth code together in the same subpackage.Could you rework the patch to do this? Here's some documentation on how applications can specify custom django-admin.py actions: http://www.djangoproject.com/documentation/django-admin/#customized-actions