module DeviseBasecamper::Authentication::ClassMethods

Public Instance Methods

authenticate_with_login?(conditions={}) click to toggle source
# File lib/devise-basecamper/authentication.rb, line 25
def authenticate_with_login?(conditions={})
  if conditions.any?
    authentication_keys.include?(basecamper[:login_attribute]) && conditions.include?(basecamper[:login_attribute])
  else
    authentication_keys.include? basecamper[:login_attribute]
  end
end
find_for_authentication(conditions={}) click to toggle source

Override the find_for_authentication finder

We will clean the conditions provided to make sure that the proper resource can/will be found.

Calls superclass method
# File lib/devise-basecamper/authentication.rb, line 14
def find_for_authentication(conditions={})
  conditions = clean_conditions_for_subdomain(conditions)

  ## Process if "login" key used instead of default (:email)
  if authenticate_with_login?(conditions)
    find_for_authentication_with_login( authentication_keys, conditions )
  else
    super ## Execute original find_for_authentication code
  end
end