diff --git a/cp/app/Controllers/ContactsController.php b/cp/app/Controllers/ContactsController.php index d803e15..b493a77 100644 --- a/cp/app/Controllers/ContactsController.php +++ b/cp/app/Controllers/ContactsController.php @@ -523,6 +523,81 @@ class ContactsController extends Controller } + public function validateContact(Request $request, Response $response, $args) + { + $db = $this->container->get('db'); + // Get the current URI + $uri = $request->getUri()->getPath(); + + if ($args) { + $args = trim($args); + + if (!preg_match('/^[a-zA-Z0-9\-]+$/', $args)) { + $this->container->get('flash')->addMessage('error', 'Invalid contact ID format'); + return $response->withHeader('Location', '/contacts')->withStatus(302); + } + + $contact = $db->selectRow('SELECT id, identifier, voice, fax, email, nin, nin_type, crdate, clid, disclose_voice, disclose_fax, disclose_email FROM contact WHERE identifier = ?', + [ $args ]); + + if ($_SESSION["auth_roles"] != 0) { + $clid = $db->selectValue('SELECT registrar_id FROM registrar_users WHERE user_id = ?', [$_SESSION['auth_user_id']]); + $contact_clid = $contact['clid']; + if ($contact_clid != $clid) { + return $response->withHeader('Location', '/contacts')->withStatus(302); + } + } else { + $clid = $contact['clid']; + } + + if ($contact) { + $registrars = $db->selectRow('SELECT id, clid, name FROM registrar WHERE id = ?', [$contact['clid']]); + $iso3166 = new ISO3166(); + $countries = $iso3166->all(); + + $contactStatus = $db->selectRow('SELECT status FROM contact_status WHERE contact_id = ?', + [ $contact['id'] ]); + $contactAuth = $db->selectRow('SELECT authinfo FROM contact_authInfo WHERE contact_id = ?', + [ $contact['id'] ]); + $contactPostal = $db->select('SELECT * FROM contact_postalInfo WHERE contact_id = ?', + [ $contact['id'] ]); + + $responseData = [ + 'contact' => $contact, + 'contactStatus' => $contactStatus, + 'contactAuth' => $contactAuth, + 'contactPostal' => $contactPostal, + 'registrars' => $registrars, + 'countries' => $countries, + 'currentUri' => $uri + ]; + + $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 == 'on' || $verifyEmail == 'on' || $verifyPostal == 'on') { + $contact_validation = $db->selectRow('SELECT validation, validation_stamp, validation_log FROM contact WHERE identifier = ?', [ $args ]); + $responseData['contact_valid'] = $contact_validation['validation']; + $responseData['validation_enabled'] = true; + $responseData['verifyPhone'] = $verifyPhone; + $responseData['verifyEmail'] = $verifyEmail; + $responseData['verifyPostal'] = $verifyPostal; + } + + return view($response, 'admin/contacts/validateContact.twig', $responseData); + } else { + // Contact does not exist, redirect to the contacts view + return $response->withHeader('Location', '/contacts')->withStatus(302); + } + + } else { + // Redirect to the contacts view + return $response->withHeader('Location', '/contacts')->withStatus(302); + } + + } + public function updateContactProcess(Request $request, Response $response) { if ($request->getMethod() === 'POST') { diff --git a/cp/resources/views/admin/contacts/updateContact.twig b/cp/resources/views/admin/contacts/updateContact.twig index c702ee4..91fe3af 100644 --- a/cp/resources/views/admin/contacts/updateContact.twig +++ b/cp/resources/views/admin/contacts/updateContact.twig @@ -163,7 +163,7 @@ {% if validation_enabled is not null %}
- +
{% endif %} diff --git a/cp/resources/views/admin/contacts/validateContact.twig b/cp/resources/views/admin/contacts/validateContact.twig new file mode 100644 index 0000000..c999f54 --- /dev/null +++ b/cp/resources/views/admin/contacts/validateContact.twig @@ -0,0 +1,87 @@ +{% extends "layouts/app.twig" %} + +{% block title %}{{ __('Contact Validation') }}{% endblock %} + +{% block content %} +
+ + + +
+
+
+
+
+

{{ __('Contact') }} {{ contact.identifier }} {{ contactStatus.status }}{% if contactLinked is not null %} {{ __('linked') }}{% endif %} + {% if validation_enabled is not null %} + + {% if contact_valid == 0 %} + Pending Validation + {% elseif contact_valid == 1 %} + Validated by Phone + {% elseif contact_valid == 2 %} + Validated by Email + {% elseif contact_valid == 3 %} + Validated by Postal Mail + {% endif %} + + {% endif %}

+ +
+
+ {% if verifyPhone == 'on' %} + {# The content you want to echo if verifyPhone is 'on' #} +

+ Phone verification is enabled. +

+
+
Validation TBD.
+
+ {% endif %} + + {% if verifyEmail == 'on' %} + {# The content you want to echo if verifyEmail is 'on' #} +

+ Email verification is enabled. +

+
+
Validation TBD.
+
+ {% endif %} + + {% if verifyPostal == 'on' %} + {# The content you want to echo if verifyPostal is 'on' #} +

+ Postal Mail verification is enabled. +

+
+
Validation TBD.
+
+ {% endif %} +
+
+
+
+
+ {% include 'partials/footer.twig' %} +
+{% endblock %} \ No newline at end of file diff --git a/cp/resources/views/admin/system/registry.twig b/cp/resources/views/admin/system/registry.twig index 5609970..7aa5156 100644 --- a/cp/resources/views/admin/system/registry.twig +++ b/cp/resources/views/admin/system/registry.twig @@ -83,11 +83,11 @@
- +