class Autho::Authentication

Public Instance Methods

user() click to toggle source
# File lib/autho/authentication.rb, line 8
def user
  user = finder.find_by_email(email)
  user && authenticate(user, password)
end

Private Instance Methods

authenticate(user, unencrypted_password) click to toggle source
# File lib/autho/authentication.rb, line 15
def authenticate(user, unencrypted_password)
  # This is BCcrypt being cryptic. It overrides "==" to compare hashes.
  if BCrypt::Password.new(user.password_digest) == unencrypted_password
    user
  else
    nil
  end
end