protected function _unauthenticated(Controller $controller)
{
if (empty($this->_authenticateObjects)) {
$this->constructAuthenticate();
}
$auth = end($this->_authenticateObjects);
$result = $auth->unauthenticated($this->request, $this->response);
if ($result !== null) {
return $result;
}
if (!$this->storage()->redirectUrl()) {
$this->storage()->redirectUrl($this->request->here(false));
}
if (!$controller->request->is('ajax')) {
$this->flash($this->_config['authError']);
$this->storage()->redirectUrl($controller->request->here(false));
return $controller->redirect($this->_config['loginAction']);
}
if (!empty($this->_config['ajaxLogin'])) {
$controller->viewBuilder()->templatePath('Element');
$response = $controller->render($this->_config['ajaxLogin'], $this->RequestHandler->ajaxLayout);
$response->statusCode(403);
return $response;
}
$this->response->statusCode(403);
return $this->response;
}