Module: Clearance::Model::ClassMethods

Defined in:
lib/clearance/model.rb

Instance Method Summary collapse

Instance Method Details

#authenticate(email, password) ⇒ Object



29
30
31
32
# File 'lib/clearance/model.rb', line 29

def authenticate(email, password)
  user = find_by_email(email) # need to get the salt
  user && user.authenticated?(password) ? user : nil
end

#authenticate_via_auth_token(token) ⇒ Object



34
35
36
37
# File 'lib/clearance/model.rb', line 34

def authenticate_via_auth_token(token)
  return nil if token.blank?
  find_by_auth_token(token)
end