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 37
def auth_key(method = false)
  @auth_key = method.to_s unless method == false
  @auth_key = nil if @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 28
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 19
def locate(key)
  raise NotImplementedError
end