if (!
$this->
checkRequest($request)) { throw new CSRFTokenValidationException(sprintf('The provided X-CSRF-Token for path "%s" is invalid. Please go back, reload the page and try again.',
$request->
getRequestUri()));
} // mark request as validated to avoid double validation
$request->
setAttribute(self::CSRF_WAS_VALIDATED, true
);
} public function clearExistingCookie(): void
{ $shop =
$this->contextService->
getShopContext()->
getShop();
$name =
$this->
getCsrfName();
$response =
$this->container->
get('front'
)->
Response();
$response->headers->
setCookie(new Cookie( $name,
Random::
getAlphanumericString(30
),
0,
sprintf('%s/',
$shop->
getPath() ?: ''
),
'',
$shop->
getSecure(),
false
));
}