From f922f401635434c60b6505620ee19005cb807998 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bidegain Date: Tue, 28 May 2024 15:34:05 +0200 Subject: [PATCH] stop contact form process if there's an error in the controller --- contactform.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/contactform.php b/contactform.php index 2740ed3..dce53ec 100644 --- a/contactform.php +++ b/contactform.php @@ -406,8 +406,6 @@ public function sendMessage() [], 'Shop.Notifications.Error' ); - - return; } if (empty($message)) { $this->context->controller->errors[] = $this->trans( @@ -415,8 +413,6 @@ public function sendMessage() [], 'Shop.Notifications.Error' ); - - return; } if (!Validate::isCleanHtml($message)) { $this->context->controller->errors[] = $this->trans( @@ -424,8 +420,6 @@ public function sendMessage() [], 'Shop.Notifications.Error' ); - - return; } $id_contact = (int) Tools::getValue('id_contact'); @@ -437,8 +431,6 @@ public function sendMessage() [], 'Modules.Contactform.Shop' ); - - return; } if (!empty($file_attachment['name']) && $file_attachment['error'] != 0) { @@ -447,8 +439,6 @@ public function sendMessage() [], 'Modules.Contactform.Shop' ); - - return; } if (!empty($file_attachment['name']) && !in_array(Tools::strtolower(Tools::substr($file_attachment['name'], -4)), $extension) && @@ -459,8 +449,6 @@ public function sendMessage() [], 'Modules.Contactform.Shop' ); - - return; } if ($url !== '' || empty($serverToken) @@ -473,7 +461,9 @@ public function sendMessage() 'Modules.Contactform.Shop' ); $this->createNewToken(); + } + if (!empty($this->context->controller->errors)) { return; }