Compare commits
No commits in common. "main" and "5.0.0" have entirely different histories.
1 changed files with 1 additions and 8 deletions
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
use App\Form\UserNameFormType;
|
use App\Form\UserNameFormType;
|
||||||
use DateTimeImmutable;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Cookie;
|
use Symfony\Component\HttpFoundation\Cookie;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
|
@ -34,13 +33,7 @@ final class HomeController extends AbstractController
|
||||||
$response->headers->clearCookie('username');
|
$response->headers->clearCookie('username');
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
$response->headers->setCookie(
|
$response->headers->setCookie(new Cookie('username', $username));
|
||||||
new Cookie(
|
|
||||||
name: 'username',
|
|
||||||
value: $username,
|
|
||||||
expire: new DateTimeImmutable('+1 year'),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
$username = $request->cookies->get('username', self::DEFAULT_USERNAME);
|
$username = $request->cookies->get('username', self::DEFAULT_USERNAME);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue