feat(api): add spam content detection for forms
- Add SpamDetectionService to detect gibberish/random text - Detect excessive consonants, low vowel ratio, mixed case patterns - Detect repeated characters and extremely long words - Validate names look realistic (start with letter, have vowels) - Cross-validate multiple suspicious fields - Integrate with ContactFormAjaxHandler and NewsletterAjaxHandler - Log blocked attempts to debug.log Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -146,17 +146,22 @@ try {
|
||||
// Obtener servicio de validacion reCAPTCHA para inyectar en handlers
|
||||
$recaptchaService = $container->getRecaptchaValidationService();
|
||||
|
||||
// Crear servicio de deteccion de spam para validar contenido
|
||||
$spamDetectionService = new \ROITheme\Shared\Application\Services\SpamDetectionService();
|
||||
|
||||
// Crear y registrar el handler AJAX para el Contact Form (público)
|
||||
$contactFormAjaxHandler = new \ROITheme\Public\ContactForm\Infrastructure\Api\WordPress\ContactFormAjaxHandler(
|
||||
$container->getComponentSettingsRepository(),
|
||||
$recaptchaService
|
||||
$recaptchaService,
|
||||
$spamDetectionService
|
||||
);
|
||||
$contactFormAjaxHandler->register();
|
||||
|
||||
// Crear y registrar el handler AJAX para Newsletter (público)
|
||||
$newsletterAjaxHandler = new \ROITheme\Public\Footer\Infrastructure\Api\WordPress\NewsletterAjaxHandler(
|
||||
$container->getComponentSettingsRepository(),
|
||||
$recaptchaService
|
||||
$recaptchaService,
|
||||
$spamDetectionService
|
||||
);
|
||||
$newsletterAjaxHandler->register();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user