how to retrieve password in django
No. It's impossible, by design. But there should never be a need to do it anyway.
You can check if the password is correct with:
u.check_password("your password")
This method and u.set_password("you password")
solves all of your problems.
sha1$f0971$441cac8f604d49869e33ca125a76253a02fef64e
is:
hash function algorithm $
salt $
hash code
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()
no. and there shouldn't be. as part of the security, passwords are passed through a one-way function before they are saved, so that they aren't reveled if the database is compromised
what you can do is replace the user's password with one you know. this is how (good) site's "forgot your password" functions work: they send you a new random password, not your old one, since they (shouldn't) have access to it