From a63e2bc5a99fd16f03781738ebe2d68f16bffe50 Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Mon, 19 Feb 2024 13:01:46 +0200 Subject: [PATCH] Small fix on validation --- cp/app/Controllers/ContactsController.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/cp/app/Controllers/ContactsController.php b/cp/app/Controllers/ContactsController.php index 7533da2..487a924 100644 --- a/cp/app/Controllers/ContactsController.php +++ b/cp/app/Controllers/ContactsController.php @@ -531,6 +531,15 @@ class ContactsController extends Controller public function validateContact(Request $request, Response $response, $args) { $db = $this->container->get('db'); + $verifyPhone = $db->selectValue("SELECT value FROM settings WHERE name = 'verifyPhone'"); + $verifyEmail = $db->selectValue("SELECT value FROM settings WHERE name = 'verifyEmail'"); + $verifyPostal = $db->selectValue("SELECT value FROM settings WHERE name = 'verifyPostal'"); + + if ($verifyPhone === NULL && $verifyEmail === NULL && $verifyPostal === NULL) { + // Redirect to the contacts view + return $response->withHeader('Location', '/contacts')->withStatus(302); + } + // Get the current URI $uri = $request->getUri()->getPath(); @@ -642,9 +651,18 @@ class ContactsController extends Controller public function approveContact(Request $request, Response $response) { if ($request->getMethod() === 'POST') { + $db = $this->container->get('db'); + $verifyPhone = $db->selectValue("SELECT value FROM settings WHERE name = 'verifyPhone'"); + $verifyEmail = $db->selectValue("SELECT value FROM settings WHERE name = 'verifyEmail'"); + $verifyPostal = $db->selectValue("SELECT value FROM settings WHERE name = 'verifyPostal'"); + + if ($verifyPhone === NULL && $verifyEmail === NULL && $verifyPostal === NULL) { + // Redirect to the contacts view + return $response->withHeader('Location', '/contacts')->withStatus(302); + } + // Retrieve POST data $data = $request->getParsedBody(); - $db = $this->container->get('db'); // Get the current URI $uri = $request->getUri()->getPath();