private function login(Identity $identity, $sessionDuration = 0): bool
    {
        $returnUrl = $this->user->getReturnUrl();

        $result = $this->user->login($identity, $sessionDuration ? null : 0);
        if ($result && $returnUrl !== null) {
            $this->user->setReturnUrl($returnUrl);
        }

        return $result;
    }