I am trying to finish a project. I am working with user models. When I signup everything seems ok . But when I try to signin the same member I get this error.
We\'
I already had live users, and likewise already saved unencrypted passwords into the database. Once I started using bcrypt, it was expecting an encrypted password, and when it didn't find it, it produced this error.
Therefore, I added this rescue to catch the error and prompt the legacy users to reset their password:
begin
# your code that attempts to login the user
rescue BCrypt::Errors::InvalidHash
flash[:error] = 'We recently adjusted the way our passwords are stored. Please click the "forgot username or password?" link to re-establish your password. Thank you for your understanding!'
redirect_to password_resets_url
end
Hope this helps.