class Devise::Strategies::Authenticatable

def validate(resource, &block)

unauthenticated_message.
In case the resource can't be validated, it will fail with the given

for more information.
given as parameter. Check Devise::Models::Authenticable.valid_for_authentication?
An optional block that will be triggered while validating can be optionally
Receives a resource and check if it is valid by calling valid_for_authentication?
def validate(resource, &block)
  unless resource
    ActiveSupport::Deprecation.warn "an empty resource was given to #{self.class.name}#validate. " \
      "Please ensure the resource is not nil", caller
  end
  result = resource && resource.valid_for_authentication?(&block)
  case result
  when Symbol, String
    ActiveSupport::Deprecation.warn "valid_for_authentication? should return a boolean value"
    fail!(result)
    return false
  end
  if result
    decorate(resource)
    true
  else
    if resource
      fail!(resource.unauthenticated_message)
    end
    false
  end
end