On my password reset page, I save the user's new password using Security::hash(). When I then try to log in though, my database saved hashed password does not match the version t开发者_开发百科hat Auth comes up with when hashing my input in the login field.
I assume this is something like Security::hash() using my application salt to hash the password, whereas Auth doesn't use that salt?
How do you go about this?
Have you tried the AuthComponent::password()
method instead?
Also, if the field is named password
, check that AuthComponent hasn't already hashed it.
Edit: In 3.x, see DefaultPasswordHasher::hash()
instead, as explained in Hashing Passwords.
should be Security::hash($password, 'sha1', true)
you can leave the second parameter NULL because Auth use the same hash as specified in Security.
精彩评论