diff --git a/public/typo3conf/ext/ep_events/Classes/Controller/AjaxFormController.php b/public/typo3conf/ext/ep_events/Classes/Controller/AjaxFormController.php index 1772838e..cf1b2b74 100644 --- a/public/typo3conf/ext/ep_events/Classes/Controller/AjaxFormController.php +++ b/public/typo3conf/ext/ep_events/Classes/Controller/AjaxFormController.php @@ -31,11 +31,14 @@ use EP\EpEvents\Domain\Model\Inquiry; use EP\EpEvents\Service\ConfigurationService; use EP\EpEvents\Service\EmailService; use EP\EpEvents\Service\SpamProtectService; +use Psr\Log\LoggerAwareInterface; +use Psr\Log\LoggerAwareTrait; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; -class AjaxFormController extends ActionController +class AjaxFormController extends ActionController implements LoggerAwareInterface { + use LoggerAwareTrait; /** * @var EmailService @@ -70,7 +73,9 @@ class AjaxFormController extends ActionController */ public function processInquiryFormAction(Inquiry $inquiry) { - if (false === $this->spamProtectService->isSpamEmail($inquiry->getEmail())) { + if (true === $this->spamProtectService->isSpamEmail($inquiry->getEmail())) { + $this->logger->warning('Dropped potential SPAM', $inquiry->toArray()); + } else { $this->emailService->send([ 'toEmail' => $this->settings['inquiryToEmail'], 'toName' => $this->settings['inquiryToName'], @@ -90,7 +95,9 @@ class AjaxFormController extends ActionController */ public function processConfiguratorFormAction(Inquiry $inquiry) { - if (false === $this->spamProtectService->isSpamEmail($inquiry->getEmail())) { + if (true === $this->spamProtectService->isSpamEmail($inquiry->getEmail())) { + $this->logger->warning('Dropped potential SPAM', $inquiry->toArray()); + } else { $this->emailService->send([ 'toEmail' => $this->settings['inquiryToEmail'], 'toName' => $this->settings['inquiryToName'], diff --git a/public/typo3conf/ext/ep_events/Classes/Domain/Model/Inquiry.php b/public/typo3conf/ext/ep_events/Classes/Domain/Model/Inquiry.php index d533d965..51ae432b 100644 --- a/public/typo3conf/ext/ep_events/Classes/Domain/Model/Inquiry.php +++ b/public/typo3conf/ext/ep_events/Classes/Domain/Model/Inquiry.php @@ -459,4 +459,13 @@ class Inquiry extends AbstractValueObject $this->pageUrl = $pageUrl; } + public function toArray() + { + return [ + 'name' => $this->name, + 'email' => $this->email, + 'message' => $this->message, + 'pageUrl' => $this->pageUrl, + ]; + } }