public function loginRequired($checkAjax = true, $checkAcceptHeader = true)
    {
        $request = $this->request;
        $canRedirect = !$checkAcceptHeader || $this->checkRedirectAcceptable();
        if ($this->enableSession
            && $request->getIsGet()
            && (!$checkAjax || !$request->getIsAjax())
            && $canRedirect
        ) {
            $this->setReturnUrl($request->getUrl());
        }
        if ($this->loginUrl !== null && $canRedirect) {
            $loginUrl = (array)$this->loginUrl;
            if ($loginUrl[0] !== $this->app->getRoute()->getRoutePath(true)) {
                return $this->app->response->redirect($this->loginUrl);
            }
        }
        throw new ForbiddenException(Reaction::t('rct', 'Login Required'));
    }