public function redirectToLogin($query = null, $httpRequest = null)
    {
        /* Attempt to extract afterLogin param from the request referer.
         * Login form submissions are sent to /login (without any GET query params)
         * So in case of unsuccessful login attempt the afterLogin information would be lost.
         */
        if ($httpRequest && $httpRequest->headers->has("referer")) {
            $referer = $httpRequest->headers->get("referer");
            $page = Utils::getRefererQueryParam($referer, "afterLogin");
            if (Utils::isValidPageId($page)) {
                $query .= ($query ? '&' : '') . "afterLogin=" . $page;
            }
        }

        $this->redirectToPage("login", $query);
    }
public function redirectToLogin($query = null, $httpRequest = null)
    {
        /* Attempt to extract afterLogin param from the request referer.
         * Login form submissions are sent to /login (without any GET query params)
         * So in case of unsuccessful login attempt the afterLogin information would be lost.
         */
        if ($httpRequest && $httpRequest->headers->has("referer")) {
            $referer = $httpRequest->headers->get("referer");
            $page = Utils::getRefererQueryParam($referer, "afterLogin");
            if (Utils::isValidPageId($page)) {
                $query .= ($query ? '&' : '') . "afterLogin=" . $page;
            }
        }

        $this->redirectToPage("login", $query);
    }
{@inheritdoc}