diff --git a/src/Service/PasswordPathService.php b/src/Service/PasswordPathService.php index de68f1f..205b40c 100644 --- a/src/Service/PasswordPathService.php +++ b/src/Service/PasswordPathService.php @@ -24,6 +24,7 @@ public function __construct( { } + // phpcs:ignore public function checkPasswordInPath(CategoryEntity $category, PageLoadedEvent|HttpCacheHitEvent|CoreHttpCacheHitEvent $event) { $context = Context::createDefaultContext(); @@ -58,9 +59,12 @@ public function checkPasswordInPath(CategoryEntity $category, PageLoadedEvent|Ht } } + // phpcs:ignore private function checkAuthenticated(PageLoadedEvent|HttpCacheHitEvent|CoreHttpCacheHitEvent $event, string $navigationId) { + // phpcs:ignore $session = $event->getRequest()->getSession(); + // phpcs:ignore $redirect = $event->getRequest()->server->get('REQUEST_URI'); $session->set('redirect', $redirect); @@ -69,6 +73,7 @@ private function checkAuthenticated(PageLoadedEvent|HttpCacheHitEvent|CoreHttpCa } } +// phpcs:ignore public function findNavigation(mixed $navigationId, PageLoadedEvent|HttpCacheHitEvent|CoreHttpCacheHitEvent $event) { $category = $this->categoryRepository->search(new Criteria([$navigationId]), Context::createDefaultContext())->first(); diff --git a/src/Storefront/Controller/PasswordPageController.php b/src/Storefront/Controller/PasswordPageController.php index 6d8e1aa..bb962f5 100644 --- a/src/Storefront/Controller/PasswordPageController.php +++ b/src/Storefront/Controller/PasswordPageController.php @@ -34,7 +34,7 @@ public function showLogin(Request $request, SalesChannelContext $salesChannelCon $page = $this->genericPageLoader->load($request, $salesChannelContext); return $this->renderStorefront('@ImiDiPasswordProtectedPages/storefront/page/restricted.html.twig', [ - 'navigationId' => $request->get('navigationId'), + 'navigationId' => $request->attributes->get('navigationId'), 'page' => $page, ]); } @@ -44,7 +44,7 @@ public function showLogin(Request $request, SalesChannelContext $salesChannelCon */ public function login(Request $request): Response { - $navigationId = $request->get('navigationId'); + $navigationId = $request->attributes->get('navigationId'); if(!$request->request->has('password')) { $this->addFlash(self::DANGER, $this->trans('ImiDi.password-incorrect')); diff --git a/src/Subscriber/CheckPasswordSubscriber.php b/src/Subscriber/CheckPasswordSubscriber.php index 42f191d..099b290 100644 --- a/src/Subscriber/CheckPasswordSubscriber.php +++ b/src/Subscriber/CheckPasswordSubscriber.php @@ -30,6 +30,7 @@ public static function getSubscribedEvents(): array return [ GenericPageLoadedEvent::class => 'onPageLoaded', /** @deprecated tag:v6.6.0 - Delete HttpCacheHitEvent and use CoreHttpCacheHitEvent instead */ + // phpcs:ignore HttpCacheHitEvent::class => 'onCachedPageLoaded', CoreHttpCacheHitEvent::class => 'onCachedPageLoaded', KernelEvents::EXCEPTION => 'onException', @@ -54,11 +55,14 @@ public function onPageLoaded(PageLoadedEvent $event) $this->passwordPathService->checkPasswordInPath($activeNavigation, $event); } + // phpcs:ignore public function onCachedPageLoaded(HttpCacheHitEvent|CoreHttpCacheHitEvent $event) { if ($this->router instanceof RequestMatcherInterface) { + // phpcs:ignore $parameters = $this->router->matchRequest($event->getRequest()); } else { + // phpcs:ignore $parameters = $this->router->match($event->getRequest()->getPathInfo()); }