On déplace la gestion du contrôle du Captcha dans un controller spécifique --> c'est plus propre (merci Franck :-)
This commit is contained in:
@@ -50,15 +50,6 @@ class ContactController extends BaseFrontController
|
||||
try {
|
||||
$form = $this->validateForm($contactForm);
|
||||
|
||||
$checkModule = ModuleQuery::create()
|
||||
->findOneByCode('ReCaptcha');
|
||||
|
||||
if($checkModule && $checkModule->getActivate()){
|
||||
$checkCaptchaEvent = new ReCaptchaCheckEvent();
|
||||
$this->dispatch(ReCaptchaEvents::CHECK_CAPTCHA_EVENT, $checkCaptchaEvent);
|
||||
if ($checkCaptchaEvent->isHuman() == false) { throw new FormValidationException('Veuillez confirmer que vous n\'êtes pas un robot.'); }
|
||||
}
|
||||
|
||||
$this->getMailer()->sendSimpleEmailMessage(
|
||||
[ ConfigQuery::getStoreEmail() => $form->get('name')->getData() ],
|
||||
[ ConfigQuery::getStoreEmail() => ConfigQuery::getStoreName() ],
|
||||
|
||||
@@ -164,18 +164,7 @@ class CustomerController extends BaseFrontController
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($customerCreation, "post");
|
||||
|
||||
$checkModule = ModuleQuery::create()
|
||||
->findOneByCode('ReCaptcha');
|
||||
|
||||
if($checkModule && $checkModule->getActivate()){
|
||||
$checkCaptchaEvent = new ReCaptchaCheckEvent();
|
||||
$this->dispatch(ReCaptchaEvents::CHECK_CAPTCHA_EVENT, $checkCaptchaEvent);
|
||||
if ($checkCaptchaEvent->isHuman() == false) { throw new \Exception('Veuillez confirmer que vous n\'êtes pas un robot.'); }
|
||||
}
|
||||
|
||||
$customerCreateEvent = $this->createEventInstance($form->getData());
|
||||
|
||||
$this->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $customerCreateEvent);
|
||||
|
||||
$newCustomer = $customerCreateEvent->getCustomer();
|
||||
|
||||
Reference in New Issue
Block a user