How do we retrieve a password of an user?
u = User.objects.get(username__exact=username) print u.password
displays sha1$f0971$441cac8f604d49869e33ca125a76253a02fef64e
Is there a function to find the password from this encoded string?
You will need to reset that users password. Try using the set_password(raw_password) method to give the user a new password. Remember to call the save() method to ensure you save the change to the database.
@anotheruser Yes, you can't 'decrypt' a hashed password through django. (A hash is a one-way function not really encryption). You could possibly save the password of the user in plaintext in the DB, when they create a user account.
Create a new superuser with the command "python manage.py createsuperuser". Login as the new super user. Click on the 'users' link. Then click on the user you want to delete.
By default, Django uses the PBKDF2 algorithm with a SHA256 hash, a password stretching mechanism recommended by NIST. This should be sufficient for most users: it's quite secure, requiring massive amounts of computing time to break.
No. It's impossible, by design. But there should never be a need to do it anyway.
Due to security restrictions the password hash method is one way. You will need to reset that users password.
Try using the set_password(raw_password)
method to give the user a new password. Remember to call the save()
method to ensure you save the change to the database.
u = User.objects.get(username__exact=username) u.set_password(raw_password) u.save()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With