Reputation: 2557
I'd like to reset a user password, but only have access to the Postgres database. Dropping in plaintext doesn't work, and the hashing process for Django appears to be too complex to replicate.
Any thoughts?
Upvotes: 1
Views: 1176
Reputation: 141
You can get a backup on your dev machine and create a new superuser by doing:
python3 manage.py createsuperuser --email <email> --username <username>
Then you will be able to login and change passwords as you like. Maybe restore the backup afterwards.
I know this does not answer your question because you also need to have access to the repo, but maybe it helps someone else.
Upvotes: 0
Reputation: 74
from django.contrib.auth.models import User
u = User.objects.get(username="username")
u.set_password("New Password")
u.save()
Upvotes: -1
Reputation: 44353
the hashing process for Django appears to be too complex to replicate
If this is true, then I think the definitive answer is "You can't change it from inside PostgreSQL".
Upvotes: 0