$salesChannelId =
$context ?
$context->
getSalesChannelId() : null;
$activeCaptchas =
(array) ($this->systemConfigService->
get('core.basicInformation.activeCaptchasV2',
$salesChannelId) ??
[]);
foreach ($this->captchas
as $captcha) { $captchaConfig =
$activeCaptchas[$captcha->
getName()] ??
[];
$request =
$event->
getRequest();
if ( $captcha->
supports($request,
$captchaConfig) && !
$captcha->
isValid($request,
$captchaConfig) ) { if ($captcha->
shouldBreak()) { throw new CaptchaInvalidException($captcha);
} $violations =
$captcha->
getViolations();
$event->
setController(fn () =>
$this->errorController->
onCaptchaFailure($violations,
$request));
// Return on first invalid captcha
return;
} } }}