increade coookie time
Some checks failed
/ ls (pull_request) Failing after 25s
/ ls (release) Successful in 1m4s
/ ls (push) Successful in 1m38s

This commit is contained in:
lubiana 2025-07-16 19:52:50 +02:00
parent 0b4fe7f44a
commit 95fa74a2b0
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk

View file

@ -3,6 +3,7 @@
namespace App\Controller;
use App\Form\UserNameFormType;
use DateTimeImmutable;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\RedirectResponse;
@ -33,7 +34,13 @@ final class HomeController extends AbstractController
$response->headers->clearCookie('username');
return $response;
}
$response->headers->setCookie(new Cookie('username', $username));
$response->headers->setCookie(
new Cookie(
name: 'username',
value: $username,
expire: new DateTimeImmutable('+1 year'),
)
);
return $response;
}
$username = $request->cookies->get('username', self::DEFAULT_USERNAME);