Updating password with BCrypt
问题 When I login with a username and password by BCrypt checks no problem, everything is fine. But when I go through the process of recovering password and try to login with the new password the BCrypt never returns true. The code I have is as follows: before_save :encrypt_password before_update :encrypt_password def authenticate player = Player.find_by(mail: self.mail) unless player.nil? current_password = BCrypt::Password.new(player.password) if current_password == self.password player else nil