From aca7d2c7a8253f70a94d5b0a9ec81933e9b1790f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20LIMOUZIN?= Date: Fri, 5 Jul 2024 15:23:52 +0200 Subject: [PATCH] Check if request is for RequestProtectedAccessType only on POST request --- .../bundle/Listener/PasswordProvided.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/components/ProtectedContentBundle/bundle/Listener/PasswordProvided.php b/components/ProtectedContentBundle/bundle/Listener/PasswordProvided.php index 95011df6a..5265e3053 100644 --- a/components/ProtectedContentBundle/bundle/Listener/PasswordProvided.php +++ b/components/ProtectedContentBundle/bundle/Listener/PasswordProvided.php @@ -26,16 +26,15 @@ class PasswordProvided /** * @var FormFactoryInterface */ - private $formFactory; - - public function __construct(FormFactoryInterface $formFactory) - { - $this->formFactory = $formFactory; - } + public function __construct(private readonly FormFactoryInterface $formFactory) + { } public function onKernelRequest(RequestEvent $event): void { - if (!$event->isMasterRequest()) { + if (!$event->isMainRequest()) { + return; + } + if (!$event->getRequest()->isMethod('POST')) { return; } $form = $this->formFactory->create(RequestProtectedAccessType::class);