Skip to content

Commit

Permalink
#18 fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
iMiMWeis committed Mar 1, 2024
1 parent 124f342 commit 198dc9c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/Service/PasswordPathService.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function __construct(
{
}

// phpcs:ignore
public function checkPasswordInPath(CategoryEntity $category, PageLoadedEvent|HttpCacheHitEvent|CoreHttpCacheHitEvent $event)
{
$context = Context::createDefaultContext();
Expand Down Expand Up @@ -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);

Expand All @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/Storefront/Controller/PasswordPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => json_decode($request->query->get('redirectParameters'))->navigationId,
'navigationId' => $request->attributes->get('navigationId'),
'page' => $page,
]);
}
Expand All @@ -44,7 +44,7 @@ public function showLogin(Request $request, SalesChannelContext $salesChannelCon
*/
public function login(Request $request): Response
{
$navigationId = json_decode($request->query->get('redirectParameters'))->navigationId;
$navigationId = $request->attributes->get('navigationId');

if(!$request->request->has('password')) {
$this->addFlash(self::DANGER, $this->trans('ImiDi.password-incorrect'));
Expand Down
4 changes: 4 additions & 0 deletions src/Subscriber/CheckPasswordSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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());
}

Expand Down

0 comments on commit 198dc9c

Please sign in to comment.