module DataMapper::Is::Authenticatable::ClassMethods
Class methods.
Public Instance Methods
authenticate(attributes)
click to toggle source
Finds and authenticates a resource.
@param [Hash] attributes
The attributes to search with.
@option attributes [String] :password
The clear-text password to authenticate with.
@return [DataMapper::Resource, nil]
The authenticated resource. If the resource could not be found, or the password did not match, `nil` will be returned.
# File lib/dm-is-authenticatable/is/authenticatable.rb, line 38 def authenticate(attributes) password = attributes.delete(:password) resource = self.first(attributes) if (resource && resource.has_password?(password)) return resource end end