public function login($user)
{
if (is_object($user)) {
if (!$this->model) {
throw $this->exception('Auth Model should be set');
}
$c = get_class($this->model);
if (!$user instanceof $c) {
throw $this->exception('Specified model with incompatible class')->addMoreInfo('required', $c)->addMoreInfo('supplied', get_class($user));
}
$this->model = $user;
$this->memorizeModel();
return $this;
}
$this->model->tryLoadBy($this->login_field, $user);
$this->memorizeModel();
return $this;
}