public function login(User $user, $remember = false)
    {
        if (!$user) {
            return false;
        }

        $this->regenerateSessionId();

        $this->{Services::SESSION}->set($this->sessionKey(), $user->getAuthIdentifier());

        if ($remember) {
            $rememberToken = Str::random(60);

            /** @var \Phalcon\Http\Response\Cookies|\Phalcon\Http\Response\CookiesInterface $cookies */
            $cookies = $this->{Services::COOKIES};
            $cookies->set('remember_me', $user->getAuthIdentifier() . '|' . $rememberToken, time() + (100 * 365 * 24 * 60 * 60));

            $user->setRememberToken($rememberToken);

            $user->save();
        }

        $this->user = $user;

        return true;
    }