feat(api): implement recaptcha v3 anti-spam protection
- Add RecaptchaValidatorInterface and RecaptchaResult entity in Domain - Create RecaptchaValidationService in Application layer - Implement GoogleRecaptchaValidator for API integration - Add recaptcha-settings schema and admin FormBuilder - Integrate reCAPTCHA validation in NewsletterAjaxHandler - Integrate reCAPTCHA validation in ContactFormAjaxHandler - Update FooterRenderer and ContactFormRenderer with reCAPTCHA scripts - Configure DIContainer with RecaptchaValidationService injection Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ROITheme\Admin\RecaptchaSettings\Infrastructure\FieldMapping;
|
||||
|
||||
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
||||
|
||||
/**
|
||||
* Field Mapper para reCAPTCHA Settings
|
||||
*
|
||||
* RESPONSABILIDAD:
|
||||
* - Mapear field IDs del formulario a atributos de BD
|
||||
* - Solo conoce sus propios campos (modularidad)
|
||||
*
|
||||
* @package ROITheme\Admin\RecaptchaSettings\Infrastructure\FieldMapping
|
||||
*/
|
||||
final class RecaptchaSettingsFieldMapper implements FieldMapperInterface
|
||||
{
|
||||
public function getComponentName(): string
|
||||
{
|
||||
return 'recaptcha-settings';
|
||||
}
|
||||
|
||||
public function getFieldMapping(): array
|
||||
{
|
||||
return [
|
||||
// Visibility
|
||||
'recaptchaIsEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
|
||||
|
||||
// Credentials
|
||||
'recaptchaSiteKey' => ['group' => 'credentials', 'attribute' => 'site_key'],
|
||||
'recaptchaSecretKey' => ['group' => 'credentials', 'attribute' => 'secret_key'],
|
||||
|
||||
// Behavior
|
||||
'recaptchaScoreThreshold' => ['group' => 'behavior', 'attribute' => 'score_threshold'],
|
||||
'recaptchaActionNewsletter' => ['group' => 'behavior', 'attribute' => 'action_newsletter'],
|
||||
'recaptchaActionContact' => ['group' => 'behavior', 'attribute' => 'action_contact'],
|
||||
'recaptchaFailOpen' => ['group' => 'behavior', 'attribute' => 'fail_open'],
|
||||
'recaptchaLogBlocked' => ['group' => 'behavior', 'attribute' => 'log_blocked'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user