module OmniAuth::Identity::Model::ClassMethods

Public Instance Methods

auth_key(method = false) click to toggle source

Used to set or retrieve the method that will be used to get and set the user-supplied authentication key. @return [String] The method name.

# File lib/omniauth/identity/model.rb, line 50
def auth_key(method = false)
  @auth_key = method.to_s unless method == false
  @auth_key = nil if !defined?(@auth_key) || @auth_key == ''

  @auth_key || 'email'
end
authenticate(conditions, password) click to toggle source

Authenticate a user with the given key and password.

@param [String] key The unique login key provided for a given identity. @param [String] password The presumed password for the identity. @return [Model] An instance of the identity model class.

# File lib/omniauth/identity/model.rb, line 40
def authenticate(conditions, password)
  instance = locate(conditions)
  return false unless instance

  instance.authenticate(password)
end
locate(_key) click to toggle source

Locate an identity given its unique login key.

@abstract @param [String] key The unique login key. @return [Model] An instance of the identity model class.

# File lib/omniauth/identity/model.rb, line 62
def locate(_key)
  raise NotImplementedError
end