hartl rails tutorial chapter 10 BCrypt::Errors::InvalidHash

195 views Asked by At

I've been following Hartl's Rails Tutorial and came across the "BCrypt::Errors::InvalidHash" error when trying to digest a token. The Hash looks fine to me so I'm not sure how to proceed. Here are the related methods on User.rb

  def authenticated?(attribute, token)
    digest = send("#{attribute}_digest")
    return false if digest.nil?
    BCrypt::Password.new(digest).is_password?(token)
  end

  def User.new_remember_token
    SecureRandom.urlsafe_base64
  end

  def User.digest(token)
    Digest::SHA1.hexdigest(token.to_s)
  end
0

There are 0 answers