I'm in the progress of migrating my website from using Authlogic to my
own authentication solution for one reason or another and I've hit a
little problem - I've set Authlogic to use bcrypt-ruby for passwords,
and now I'm confused as to how I'm supposed to work with the library
and authenticate existing users in my database.
For example, I registered a new user on my website with the password
"test". Here's the hash and salt stored in the database:
...but the result is "false". Do we need to work the salt in? And if
yes, how? Trying to pass it as a constructor argument or trying the
"salt" setter doesn't work.
...but the result is "false". Do we need to work the salt in? And if
yes, how? Trying to pass it as a constructor argument or trying the
"salt" setter doesn't work.
You're saving the crypted_password and the salt that was used to create
it, so the validation of a newly submitted password is to pass it
through the same function and compare the end results...
Does Bcrypt of "newly submitted password" and u.password_salt ==
u.crypted_password