Module: EasyAuth::Models::Identities::Password::ClassMethods

Defined in:
lib/easy_auth/models/identities/password.rb

Instance Method Summary collapse

Instance Method Details

#authenticate(controller, token_name = :password) ⇒ Object



20
21
22
23
24
# File 'lib/easy_auth/models/identities/password.rb', line 20

def authenticate(controller, token_name = :password)
  attributes = send("attributes_for_#{token_name}", controller)
  return nil if attributes.nil?
  where(send("conditions_for_#{token_name}", attributes)).first.try(:authenticate, attributes[token_name], token_name)
end