mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-13 08:07:00 +02:00
More work on contact validation
This commit is contained in:
parent
04c4382836
commit
504bb1b1eb
5 changed files with 66 additions and 7 deletions
|
@ -413,8 +413,8 @@ class ContactsController extends Controller
|
||||||
[ $contact['id'] ]);
|
[ $contact['id'] ]);
|
||||||
$contactPostal = $db->select('SELECT * FROM contact_postalInfo WHERE contact_id = ?',
|
$contactPostal = $db->select('SELECT * FROM contact_postalInfo WHERE contact_id = ?',
|
||||||
[ $contact['id'] ]);
|
[ $contact['id'] ]);
|
||||||
|
|
||||||
return view($response,'admin/contacts/viewContact.twig', [
|
$responseData = [
|
||||||
'contact' => $contact,
|
'contact' => $contact,
|
||||||
'contactStatus' => $contactStatus,
|
'contactStatus' => $contactStatus,
|
||||||
'contactLinked' => $contactLinked,
|
'contactLinked' => $contactLinked,
|
||||||
|
@ -422,7 +422,19 @@ class ContactsController extends Controller
|
||||||
'contactPostal' => $contactPostal,
|
'contactPostal' => $contactPostal,
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
'currentUri' => $uri
|
'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;
|
||||||
|
}
|
||||||
|
|
||||||
|
return view($response, 'admin/contacts/viewContact.twig', $responseData);
|
||||||
} else {
|
} else {
|
||||||
// Contact does not exist, redirect to the contacts view
|
// Contact does not exist, redirect to the contacts view
|
||||||
return $response->withHeader('Location', '/contacts')->withStatus(302);
|
return $response->withHeader('Location', '/contacts')->withStatus(302);
|
||||||
|
@ -477,8 +489,8 @@ class ContactsController extends Controller
|
||||||
[ $contact['id'] ]);
|
[ $contact['id'] ]);
|
||||||
$contactPostal = $db->select('SELECT * FROM contact_postalInfo WHERE contact_id = ?',
|
$contactPostal = $db->select('SELECT * FROM contact_postalInfo WHERE contact_id = ?',
|
||||||
[ $contact['id'] ]);
|
[ $contact['id'] ]);
|
||||||
|
|
||||||
return view($response,'admin/contacts/updateContact.twig', [
|
$responseData = [
|
||||||
'contact' => $contact,
|
'contact' => $contact,
|
||||||
'contactStatus' => $contactStatus,
|
'contactStatus' => $contactStatus,
|
||||||
'contactAuth' => $contactAuth,
|
'contactAuth' => $contactAuth,
|
||||||
|
@ -486,7 +498,19 @@ class ContactsController extends Controller
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
'countries' => $countries,
|
'countries' => $countries,
|
||||||
'currentUri' => $uri
|
'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;
|
||||||
|
}
|
||||||
|
|
||||||
|
return view($response, 'admin/contacts/updateContact.twig', $responseData);
|
||||||
} else {
|
} else {
|
||||||
// Contact does not exist, redirect to the contacts view
|
// Contact does not exist, redirect to the contacts view
|
||||||
return $response->withHeader('Location', '/contacts')->withStatus(302);
|
return $response->withHeader('Location', '/contacts')->withStatus(302);
|
||||||
|
|
|
@ -160,6 +160,22 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- You can invert the logic if you prefer the default to be 'Personal' instead of 'Business' -->
|
<!-- You can invert the logic if you prefer the default to be 'Personal' instead of 'Business' -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if validation_enabled is not null %}
|
||||||
|
<div class="mb-3">
|
||||||
|
<button class="btn btn-outline-{% if contact_valid == 0 %}secondary{% elseif contact_valid == 1 %}success{% elseif contact_valid == 2 %}success{% elseif contact_valid == 3 %}info{% endif %} w-100" {% if contact_valid == 1 %}disabled{% elseif contact_valid == 2 %}disabled{% elseif contact_valid == 3 %}disabled{% endif %}>
|
||||||
|
{% if contact_valid == 0 %}
|
||||||
|
Trigger Validation
|
||||||
|
{% elseif contact_valid == 1 %}
|
||||||
|
Validated by Phone
|
||||||
|
{% elseif contact_valid == 2 %}
|
||||||
|
Validated by Email
|
||||||
|
{% elseif contact_valid == 3 %}
|
||||||
|
Validated by Postal Mail
|
||||||
|
{% endif %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -26,7 +26,20 @@
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card mb-3">
|
<div class="card mb-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">{{ __('Contact') }} {{ contact.identifier }} <span class="status status-green">{{ contactStatus.status }}</span>{% if contactLinked is not null %} <span class="status status-info">{{ __('linked') }}</span>{% endif %}</h3>
|
<h3 class="card-title">{{ __('Contact') }} {{ contact.identifier }} <span class="status status-green">{{ contactStatus.status }}</span>{% if contactLinked is not null %} <span class="status status-info">{{ __('linked') }}</span>{% endif %}
|
||||||
|
{% if validation_enabled is not null %}
|
||||||
|
<span class="status {% if contact_valid == 0 %}status-warning{% elseif contact_valid == 1 %}status-success{% elseif contact_valid == 2 %}status-success{% elseif contact_valid == 3 %}status-info{% endif %}" title="{% 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 %}">
|
||||||
|
{% 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 %}
|
||||||
|
</span>
|
||||||
|
{% endif %}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="datagrid">
|
<div class="datagrid">
|
||||||
|
|
|
@ -248,6 +248,9 @@ CREATE TABLE IF NOT EXISTS `registry`.`contact` (
|
||||||
`disclose_voice` enum('0','1') NOT NULL default '1',
|
`disclose_voice` enum('0','1') NOT NULL default '1',
|
||||||
`disclose_fax` enum('0','1') NOT NULL default '1',
|
`disclose_fax` enum('0','1') NOT NULL default '1',
|
||||||
`disclose_email` enum('0','1') NOT NULL default '1',
|
`disclose_email` enum('0','1') NOT NULL default '1',
|
||||||
|
`validation` enum('0','1','2','3','4'),
|
||||||
|
`validation_stamp` datetime(3) default NULL,
|
||||||
|
`validation_log` varchar(255) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `identifier` (`identifier`),
|
UNIQUE KEY `identifier` (`identifier`),
|
||||||
CONSTRAINT `contact_ibfk_1` FOREIGN KEY (`clid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT,
|
CONSTRAINT `contact_ibfk_1` FOREIGN KEY (`clid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT,
|
||||||
|
|
|
@ -241,6 +241,9 @@ CREATE TABLE contact (
|
||||||
"disclose_voice" varchar CHECK ("disclose_voice" IN ( '0','1' )) NOT NULL default '1',
|
"disclose_voice" varchar CHECK ("disclose_voice" IN ( '0','1' )) NOT NULL default '1',
|
||||||
"disclose_fax" varchar CHECK ("disclose_fax" IN ( '0','1' )) NOT NULL default '1',
|
"disclose_fax" varchar CHECK ("disclose_fax" IN ( '0','1' )) NOT NULL default '1',
|
||||||
"disclose_email" varchar CHECK ("disclose_email" IN ( '0','1' )) NOT NULL default '1',
|
"disclose_email" varchar CHECK ("disclose_email" IN ( '0','1' )) NOT NULL default '1',
|
||||||
|
"validation" varchar CHECK ("validation" IN ( '0','1','2','3','4' )) default NULL,
|
||||||
|
"validation_stamp" timestamp(3) without time zone default NULL,
|
||||||
|
"validation_log" varchar(255) default NULL,
|
||||||
unique ("identifier")
|
unique ("identifier")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue