Log dropped spam messages
This commit is contained in:
@@ -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'],
|
||||
|
||||
@@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user