lithium\security\auth\adapter\Form::check()
Called by the Auth
class to run an authentication check against a model class using the
credentials in a data container (a Request
object), and returns an array of user
information on success, or false
on failure.
Parameters
-
object
$credentials
A data container which wraps the authentication credentials used to query the model (usually a
Request
object). See the documentation for this class for further details. -
array
$options
Additional configuration options. Not currently implemented in this adapter.
Returns
arrayReturns an array containing user information on success, or false
on failure.
Source
public function check($credentials, array $options = []) {
$model = $this->_model;
$query = $this->_query;
$data = $this->_filters($this->_data($credentials->data));
$validate = array_flip(array_intersect_key($this->_fields, $this->_validators));
$conditions = $this->_scope + array_diff_key($data, $validate);
$user = $model::$query(compact('conditions') + $options);
if (!$user) {
return false;
}
return $this->_validate($user, $data);
}