mirror of
https://github.com/getnamingo/registry.git
synced 2025-06-28 07:03:28 +02:00
More work on the panel
This commit is contained in:
parent
ee02066073
commit
ae0c1ee158
5 changed files with 619 additions and 37 deletions
|
@ -10,12 +10,12 @@ use League\ISO3166\ISO3166;
|
||||||
|
|
||||||
class ContactsController extends Controller
|
class ContactsController extends Controller
|
||||||
{
|
{
|
||||||
public function view(Request $request, Response $response)
|
public function listContacts(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
return view($response,'admin/contacts/view.twig');
|
return view($response,'admin/contacts/listContacts.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(Request $request, Response $response)
|
public function createContact(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
if ($request->getMethod() === 'POST') {
|
if ($request->getMethod() === 'POST') {
|
||||||
// Retrieve POST data
|
// Retrieve POST data
|
||||||
|
@ -58,7 +58,7 @@ class ContactsController extends Controller
|
||||||
$authInfo_pw = $data['authInfo'] ?? null;
|
$authInfo_pw = $data['authInfo'] ?? null;
|
||||||
|
|
||||||
if (!$contactID) {
|
if (!$contactID) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Please provide a contact ID',
|
'error' => 'Please provide a contact ID',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -70,7 +70,7 @@ class ContactsController extends Controller
|
||||||
// Validation for contact ID
|
// Validation for contact ID
|
||||||
$invalid_identifier = validate_identifier($contactID);
|
$invalid_identifier = validate_identifier($contactID);
|
||||||
if ($invalid_identifier) {
|
if ($invalid_identifier) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid contact ID',
|
'error' => 'Invalid contact ID',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -81,7 +81,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
$contact = $db->select('SELECT * FROM contact WHERE identifier = ?', [$contactID]);
|
$contact = $db->select('SELECT * FROM contact WHERE identifier = ?', [$contactID]);
|
||||||
if ($contact) {
|
if ($contact) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Contact ID already exists',
|
'error' => 'Contact ID already exists',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -100,7 +100,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoIntName) {
|
if ($postalInfoIntName) {
|
||||||
if (!$postalInfoIntName) {
|
if (!$postalInfoIntName) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Missing contact name',
|
'error' => 'Missing contact name',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -110,7 +110,7 @@ class ContactsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntName) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntName)) {
|
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntName) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntName)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid contact name',
|
'error' => 'Invalid contact name',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -121,7 +121,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoIntOrg) {
|
if ($postalInfoIntOrg) {
|
||||||
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntOrg) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntOrg)) {
|
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntOrg) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntOrg)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid contact org',
|
'error' => 'Invalid contact org',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -133,7 +133,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoIntStreet1) {
|
if ($postalInfoIntStreet1) {
|
||||||
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet1) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet1)) {
|
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet1) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet1)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid contact street',
|
'error' => 'Invalid contact street',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -145,7 +145,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoIntStreet2) {
|
if ($postalInfoIntStreet2) {
|
||||||
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet2) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet2)) {
|
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet2) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet2)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid contact street',
|
'error' => 'Invalid contact street',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -157,7 +157,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoIntStreet3) {
|
if ($postalInfoIntStreet3) {
|
||||||
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet3) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet3)) {
|
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet3) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet3)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid contact street',
|
'error' => 'Invalid contact street',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -168,7 +168,7 @@ class ContactsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoIntCity) || !preg_match('/^[a-z][a-z\-\.\s]{3,}$/i', $postalInfoIntCity)) {
|
if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoIntCity) || !preg_match('/^[a-z][a-z\-\.\s]{3,}$/i', $postalInfoIntCity)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid contact city',
|
'error' => 'Invalid contact city',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -179,7 +179,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoIntSp) {
|
if ($postalInfoIntSp) {
|
||||||
if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoIntSp) || !preg_match('/^[A-Z][a-zA-Z\-\.\s]{1,}$/', $postalInfoIntSp)) {
|
if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoIntSp) || !preg_match('/^[A-Z][a-zA-Z\-\.\s]{1,}$/', $postalInfoIntSp)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid contact state/province',
|
'error' => 'Invalid contact state/province',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -191,7 +191,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoIntPc) {
|
if ($postalInfoIntPc) {
|
||||||
if (preg_match('/(^\-)|(\-\-)|(\-$)/', $postalInfoIntPc) || !preg_match('/^[A-Z0-9\-\s]{3,}$/', $postalInfoIntPc)) {
|
if (preg_match('/(^\-)|(\-\-)|(\-$)/', $postalInfoIntPc) || !preg_match('/^[A-Z0-9\-\s]{3,}$/', $postalInfoIntPc)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid contact postal code',
|
'error' => 'Invalid contact postal code',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -205,7 +205,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoLocName) {
|
if ($postalInfoLocName) {
|
||||||
if (!$postalInfoLocName) {
|
if (!$postalInfoLocName) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Missing loc contact name',
|
'error' => 'Missing loc contact name',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -215,7 +215,7 @@ class ContactsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocName) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocName)) {
|
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocName) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocName)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid loc contact name',
|
'error' => 'Invalid loc contact name',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -226,7 +226,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoLocOrg) {
|
if ($postalInfoLocOrg) {
|
||||||
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocOrg) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocOrg)) {
|
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocOrg) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocOrg)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid loc contact org',
|
'error' => 'Invalid loc contact org',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -238,7 +238,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoLocStreet1) {
|
if ($postalInfoLocStreet1) {
|
||||||
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet1) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet1)) {
|
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet1) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet1)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid loc contact street',
|
'error' => 'Invalid loc contact street',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -250,7 +250,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoLocStreet2) {
|
if ($postalInfoLocStreet2) {
|
||||||
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet2) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet2)) {
|
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet2) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet2)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid loc contact street',
|
'error' => 'Invalid loc contact street',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -262,7 +262,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoLocStreet3) {
|
if ($postalInfoLocStreet3) {
|
||||||
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet3) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet3)) {
|
if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet3) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet3)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid loc contact street',
|
'error' => 'Invalid loc contact street',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -273,7 +273,7 @@ class ContactsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoLocCity) || !preg_match('/^[a-z][a-z\-\.\s]{3,}$/i', $postalInfoLocCity)) {
|
if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoLocCity) || !preg_match('/^[a-z][a-z\-\.\s]{3,}$/i', $postalInfoLocCity)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid loc contact city',
|
'error' => 'Invalid loc contact city',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -284,7 +284,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoLocSp) {
|
if ($postalInfoLocSp) {
|
||||||
if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoLocSp) || !preg_match('/^[A-Z][a-zA-Z\-\.\s]{1,}$/', $postalInfoLocSp)) {
|
if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoLocSp) || !preg_match('/^[A-Z][a-zA-Z\-\.\s]{1,}$/', $postalInfoLocSp)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid loc contact state/province',
|
'error' => 'Invalid loc contact state/province',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -296,7 +296,7 @@ class ContactsController extends Controller
|
||||||
|
|
||||||
if ($postalInfoLocPc) {
|
if ($postalInfoLocPc) {
|
||||||
if (preg_match('/(^\-)|(\-\-)|(\-$)/', $postalInfoLocPc) || !preg_match('/^[A-Z0-9\-\s]{3,}$/', $postalInfoLocPc)) {
|
if (preg_match('/(^\-)|(\-\-)|(\-$)/', $postalInfoLocPc) || !preg_match('/^[A-Z0-9\-\s]{3,}$/', $postalInfoLocPc)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Invalid loc contact postal code',
|
'error' => 'Invalid loc contact postal code',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -309,7 +309,7 @@ class ContactsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($voice && (!preg_match('/^\+\d{1,3}\.\d{1,14}$/', $voice) || strlen($voice) > 17)) {
|
if ($voice && (!preg_match('/^\+\d{1,3}\.\d{1,14}$/', $voice) || strlen($voice) > 17)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Voice must be (\+[0-9]{1,3}\.[0-9]{1,14})',
|
'error' => 'Voice must be (\+[0-9]{1,3}\.[0-9]{1,14})',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -319,7 +319,7 @@ class ContactsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fax && (!preg_match('/^\+\d{1,3}\.\d{1,14}$/', $fax) || strlen($fax) > 17)) {
|
if ($fax && (!preg_match('/^\+\d{1,3}\.\d{1,14}$/', $fax) || strlen($fax) > 17)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Fax must be (\+[0-9]{1,3}\.[0-9]{1,14})',
|
'error' => 'Fax must be (\+[0-9]{1,3}\.[0-9]{1,14})',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -329,7 +329,7 @@ class ContactsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Email address failed check',
|
'error' => 'Email address failed check',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -339,7 +339,7 @@ class ContactsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$authInfo_pw) {
|
if (!$authInfo_pw) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Email contact authinfo',
|
'error' => 'Email contact authinfo',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -349,7 +349,7 @@ class ContactsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) {
|
if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Password needs to be at least 6 and up to 16 characters long',
|
'error' => 'Password needs to be at least 6 and up to 16 characters long',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -359,7 +359,7 @@ class ContactsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/[A-Z]/', $authInfo_pw)) {
|
if (!preg_match('/[A-Z]/', $authInfo_pw)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'Password should have both upper and lower case characters',
|
'error' => 'Password should have both upper and lower case characters',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -383,7 +383,7 @@ class ContactsController extends Controller
|
||||||
$nin_type = (isset($data['isBusiness']) && $data['isBusiness'] === 1) ? 'business' : 'personal';
|
$nin_type = (isset($data['isBusiness']) && $data['isBusiness'] === 1) ? 'business' : 'personal';
|
||||||
|
|
||||||
if (!preg_match('/\d/', $nin)) {
|
if (!preg_match('/\d/', $nin)) {
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => 'NIN should contain one or more numbers',
|
'error' => 'NIN should contain one or more numbers',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -481,7 +481,7 @@ class ContactsController extends Controller
|
||||||
$db->commit();
|
$db->commit();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$db->rollBack();
|
$db->rollBack();
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'error' => $e->getMessage(),
|
'error' => $e->getMessage(),
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -495,7 +495,7 @@ class ContactsController extends Controller
|
||||||
[$contact_id]
|
[$contact_id]
|
||||||
);
|
);
|
||||||
|
|
||||||
return view($response, 'admin/contacts/create.twig', [
|
return view($response, 'admin/contacts/createContact.twig', [
|
||||||
'contactID' => $contactID,
|
'contactID' => $contactID,
|
||||||
'crdate' => $crdate,
|
'crdate' => $crdate,
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -515,7 +515,7 @@ class ContactsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default view for GET requests or if POST data is not set
|
// Default view for GET requests or if POST data is not set
|
||||||
return view($response,'admin/contacts/create.twig', [
|
return view($response,'admin/contacts/createContact.twig', [
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
'countries' => $countries,
|
'countries' => $countries,
|
||||||
'registrar' => $registrar,
|
'registrar' => $registrar,
|
||||||
|
@ -578,4 +578,274 @@ class ContactsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateContact(Request $request, Response $response, $args)
|
||||||
|
{
|
||||||
|
$db = $this->container->get('db');
|
||||||
|
// Get the current URI
|
||||||
|
$uri = $request->getUri()->getPath();
|
||||||
|
|
||||||
|
if ($args) {
|
||||||
|
$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 ($contact) {
|
||||||
|
$registrars = $db->selectRow('SELECT id, clid, name FROM registrar WHERE id = ?', [$contact['clid']]);
|
||||||
|
$iso3166 = new ISO3166();
|
||||||
|
$countries = $iso3166->all();
|
||||||
|
|
||||||
|
// Check if the user is not an admin (assuming role 0 is admin)
|
||||||
|
if ($_SESSION["auth_roles"] != 0) {
|
||||||
|
$userRegistrars = $db->select('SELECT registrar_id FROM registrar_users WHERE user_id = ?', [$_SESSION['auth_user_id']]);
|
||||||
|
|
||||||
|
// Assuming $userRegistrars returns an array of arrays, each containing 'registrar_id'
|
||||||
|
$userRegistrarIds = array_column($userRegistrars, 'registrar_id');
|
||||||
|
|
||||||
|
// Check if the registrar's ID is in the user's list of registrar IDs
|
||||||
|
if (!in_array($registrars['id'], $userRegistrarIds)) {
|
||||||
|
// Redirect to the contacts view if the user is not authorized for this contact
|
||||||
|
return $response->withHeader('Location', '/contacts')->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$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'] ]);
|
||||||
|
|
||||||
|
return view($response,'admin/contacts/updateContact.twig', [
|
||||||
|
'contact' => $contact,
|
||||||
|
'contactStatus' => $contactStatus,
|
||||||
|
'contactAuth' => $contactAuth,
|
||||||
|
'contactPostal' => $contactPostal,
|
||||||
|
'registrars' => $registrars,
|
||||||
|
'countries' => $countries
|
||||||
|
]);
|
||||||
|
} 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') {
|
||||||
|
// Retrieve POST data
|
||||||
|
$data = $request->getParsedBody();
|
||||||
|
var_dump ($data);die();
|
||||||
|
$db = $this->container->get('db');
|
||||||
|
$identifier = $data['identifier'] ?? null;
|
||||||
|
|
||||||
|
$result = $db->selectRow('SELECT registrar_id FROM registrar_users WHERE user_id = ?', [$_SESSION['auth_user_id']]);
|
||||||
|
|
||||||
|
if ($_SESSION["auth_roles"] != 0) {
|
||||||
|
$clid = $result['registrar_id'];
|
||||||
|
} else {
|
||||||
|
$clid = $db->selectValue('SELECT clid FROM host WHERE name = ?', [$hostName]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ipv4 = $data['ipv4'] ?? null;
|
||||||
|
$ipv6 = $data['ipv6'] ?? null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$db->beginTransaction();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$host_id = $db->selectValue(
|
||||||
|
'SELECT id FROM host WHERE name = ?',
|
||||||
|
[$hostName]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($ipv4) && !empty($ipv4)) {
|
||||||
|
$ipv4 = normalize_v4_address($ipv4);
|
||||||
|
|
||||||
|
$does_it_exist = $db->selectValue("SELECT id FROM host_addr WHERE host_id = ? AND ip = 'v4'", [$host_id]);
|
||||||
|
|
||||||
|
if ($does_it_exist) {
|
||||||
|
$db->update(
|
||||||
|
'host_addr',
|
||||||
|
[
|
||||||
|
'addr' => $ipv4
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'host_id' => $host_id,
|
||||||
|
'ip' => 'v4'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$db->insert(
|
||||||
|
'host_addr',
|
||||||
|
[
|
||||||
|
'addr' => $ipv4,
|
||||||
|
'host_id' => $host_id,
|
||||||
|
'ip' => 'v4'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($ipv6) && !empty($ipv6)) {
|
||||||
|
$ipv6 = normalize_v6_address($ipv6);
|
||||||
|
|
||||||
|
$does_it_exist = $db->selectValue("SELECT id FROM host_addr WHERE host_id = ? AND ip = 'v6'", [$host_id]);
|
||||||
|
|
||||||
|
if ($does_it_exist) {
|
||||||
|
$db->update(
|
||||||
|
'host_addr',
|
||||||
|
[
|
||||||
|
'addr' => $ipv6
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'host_id' => $host_id,
|
||||||
|
'ip' => 'v6'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$db->insert(
|
||||||
|
'host_addr',
|
||||||
|
[
|
||||||
|
'addr' => $ipv6,
|
||||||
|
'host_id' => $host_id,
|
||||||
|
'ip' => 'v6'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentDateTime = new \DateTime();
|
||||||
|
$update = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp
|
||||||
|
|
||||||
|
$db->update('host', [
|
||||||
|
'update' => $update,
|
||||||
|
'upid' => $clid
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => $hostName
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$db->commit();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$db->rollBack();
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Database failure during update: ' . $e->getMessage());
|
||||||
|
return $response->withHeader('Location', '/host/update/'.$hostName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->container->get('flash')->addMessage('success', 'Host ' . $hostName . ' has been updated successfully on ' . $update);
|
||||||
|
return $response->withHeader('Location', '/host/update/'.$hostName)->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteContact(Request $request, Response $response, $args)
|
||||||
|
{
|
||||||
|
// if ($request->getMethod() === 'POST') {
|
||||||
|
$db = $this->container->get('db');
|
||||||
|
// Get the current URI
|
||||||
|
$uri = $request->getUri()->getPath();
|
||||||
|
|
||||||
|
if ($args) {
|
||||||
|
$contact_id = $db->selectValue('SELECT id FROM contact WHERE identifier = ?',
|
||||||
|
[ $args ]);
|
||||||
|
|
||||||
|
$is_linked_registrant = $db->selectRow('SELECT id FROM domain WHERE registrant = ?',
|
||||||
|
[ $contact_id ]);
|
||||||
|
|
||||||
|
if ($is_linked_registrant) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'This contact is associated with a domain as a registrant');
|
||||||
|
return $response->withHeader('Location', '/hosts')->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
$is_linked_other = $db->selectRow('SELECT contact_id FROM domain_contact_map WHERE contact_id = ?',
|
||||||
|
[ $contact_id ]);
|
||||||
|
|
||||||
|
if ($is_linked_other) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'This contact is associated with a domain');
|
||||||
|
return $response->withHeader('Location', '/contacts')->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
$statuses = $db->select('SELECT status FROM contact_status WHERE contact_id = ?', [$contact_id]);
|
||||||
|
|
||||||
|
foreach ($statuses as $status) {
|
||||||
|
if (preg_match('/.*(UpdateProhibited|DeleteProhibited)$/', $status['status']) || preg_match('/^pending/', $status['status'])) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'It has a status that does not allow deletion');
|
||||||
|
return $response->withHeader('Location', '/contacts')->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->delete(
|
||||||
|
'contact_postalInfo',
|
||||||
|
[
|
||||||
|
'contact_id' => $contact_id
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$db->delete(
|
||||||
|
'contact_authInfo',
|
||||||
|
[
|
||||||
|
'contact_id' => $contact_id
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$db->delete(
|
||||||
|
'contact_status',
|
||||||
|
[
|
||||||
|
'contact_id' => $contact_id
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$db->delete(
|
||||||
|
'contact',
|
||||||
|
[
|
||||||
|
'id' => $contact_id
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->container->get('flash')->addMessage('success', 'Contact ' . $args . ' deleted successfully');
|
||||||
|
return $response->withHeader('Location', '/contacts')->withStatus(302);
|
||||||
|
} else {
|
||||||
|
// Redirect to the hosts view
|
||||||
|
return $response->withHeader('Location', '/contacts')->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "layouts/app.twig" %}
|
{% extends "layouts/app.twig" %}
|
||||||
|
|
||||||
{% block title %}{{ __('Contacts') }}{% endblock %}
|
{% block title %}{{ __('Create Contact') }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="page-wrapper">
|
<div class="page-wrapper">
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
Overview
|
Overview
|
||||||
</div>
|
</div>
|
||||||
<h2 class="page-title">
|
<h2 class="page-title">
|
||||||
{{ __('Contacts') }}
|
{{ __('Create Contact') }}
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
<div class="page-body">
|
<div class="page-body">
|
||||||
<div class="container-xl">
|
<div class="container-xl">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
{% include 'partials/flash.twig' %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body border-bottom py-3">
|
<div class="card-body border-bottom py-3">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
|
|
311
cp/resources/views/admin/contacts/updateContact.twig
Normal file
311
cp/resources/views/admin/contacts/updateContact.twig
Normal file
|
@ -0,0 +1,311 @@
|
||||||
|
{% extends "layouts/app.twig" %}
|
||||||
|
|
||||||
|
{% block title %}{{ __('Update Contact') }} {{ contact.identifier }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<!-- Page header -->
|
||||||
|
<div class="page-header d-print-none">
|
||||||
|
<div class="container-xl">
|
||||||
|
<div class="row g-2 align-items-center">
|
||||||
|
<div class="col">
|
||||||
|
<!-- Page pre-title -->
|
||||||
|
<div class="page-pretitle">
|
||||||
|
Overview
|
||||||
|
</div>
|
||||||
|
<h2 class="page-title">
|
||||||
|
{{ __('Update Contact') }} {{ contact.identifier }}
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Page body -->
|
||||||
|
<div class="page-body">
|
||||||
|
<div class="container-xl">
|
||||||
|
<div class="col-12">
|
||||||
|
{% include 'partials/flash.twig' %}
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="/contact/update" method="post">
|
||||||
|
{{ csrf.field | raw }}<input type="hidden" name="identifier" value="{{ contact.identifier }}">
|
||||||
|
{% set postal_int = null %}
|
||||||
|
{% set postal_loc = null %}
|
||||||
|
|
||||||
|
{% for postal in contactPostal %}
|
||||||
|
{% if postal.type == 'int' %}
|
||||||
|
{% set postal_int = postal %}
|
||||||
|
{% elseif postal.type == 'loc' %}
|
||||||
|
{% set postal_loc = postal %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
<div class="row">
|
||||||
|
<!-- First Column: General & Internationalized Info -->
|
||||||
|
<div class="col-md-6">
|
||||||
|
<h6 class="mb-3">General & Internationalized Info</h6>
|
||||||
|
|
||||||
|
<!-- Internationalized Name -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="intName" class="form-label required">Name</label>
|
||||||
|
<input type="text" class="form-control" id="intName" name="intName" required="required" value="{{ postal_int.name }}">
|
||||||
|
<label class="form-check form-switch mt-1">
|
||||||
|
<input class="form-check-input" type="checkbox" id="discloseNameInt" name="disclose_name_int" {% if postal_int.disclose_name_int == '1' %}checked{% endif %}>
|
||||||
|
<span class="form-check-label" for="discloseNameInt">Disclose in WHOIS</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Internationalized Organization -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="intOrg" class="form-label required">Organization</label>
|
||||||
|
<input type="text" class="form-control" id="intOrg" name="org" required="required" value="{{ postal_int.org }}">
|
||||||
|
<label class="form-check form-switch mt-1">
|
||||||
|
<input class="form-check-input" type="checkbox" id="discloseOrgInt" name="disclose_org_int" {% if postal_int.disclose_org_int == '1' %}checked{% endif %}>
|
||||||
|
<span class="form-check-label" for="discloseOrgInt">Disclose in WHOIS</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Internationalized Address: Street Details -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="street1" class="form-label required">Street 1</label>
|
||||||
|
<input type="text" class="form-control" id="street1" name="street1" required="required" value="{{ postal_int.street1 }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="street2" class="form-label">Street 2</label>
|
||||||
|
<input type="text" class="form-control" id="street2" name="street2" value="{{ postal_int.street2 }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="street3" class="form-label">Street 3</label>
|
||||||
|
<input type="text" class="form-control" id="street3" name="street3" value="{{ postal_int.street3 }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Internationalized Address: City, SP, PC, CC -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="city" class="form-label required">City</label>
|
||||||
|
<input type="text" class="form-control" id="city" name="city" required="required" value="{{ postal_int.city }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="sp" class="form-label">State/Province</label>
|
||||||
|
<input type="text" class="form-control" id="sp" name="sp" value="{{ postal_int.sp }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="pc" class="form-label">Postal Code</label>
|
||||||
|
<input type="text" class="form-control" id="pc" name="pc" value="{{ postal_int.pc }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="cc" class="form-label required">Country</label>
|
||||||
|
<select class="form-select" id="cc" name="cc" required="required">
|
||||||
|
{% for country in countries %}
|
||||||
|
<option value="{{ country.alpha2|lower }}" {% if postal_int.cc == country.alpha2 %}selected{% endif %}>{{ country.name }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<label class="form-check form-switch mt-1">
|
||||||
|
<input class="form-check-input" type="checkbox" id="discloseAddrInt" name="disclose_addr_int" {% if postal_int.disclose_addr_int == '1' %}checked{% endif %}>
|
||||||
|
<span class="form-check-label" for="discloseAddrInt">Disclose Address in WHOIS</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Second Column: Voice, Fax, Email, and other details -->
|
||||||
|
<div class="col-md-6">
|
||||||
|
<h6 class="mb-3">Contact Details</h6>
|
||||||
|
|
||||||
|
<!-- Voice -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="voice" class="form-label required">Voice</label>
|
||||||
|
<input type="tel" class="form-control" id="voice" name="voice" required="required" value="{{ contact.voice }}">
|
||||||
|
<label class="form-check form-switch mt-1">
|
||||||
|
<input class="form-check-input" type="checkbox" id="discloseVoice" name="disclose_voice" {% if contact.disclose_voice == '1' %}checked{% endif %}>
|
||||||
|
<span class="form-check-label" for="discloseVoice">Disclose in WHOIS</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Fax -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="fax" class="form-label">Fax</label>
|
||||||
|
<input type="tel" class="form-control" id="fax" name="fax" value="{{ contact.fax }}">
|
||||||
|
<label class="form-check form-switch mt-1">
|
||||||
|
<input class="form-check-input" type="checkbox" id="discloseFax" name="disclose_fax" {% if contact.disclose_fax == '1' %}checked{% endif %}>
|
||||||
|
<span class="form-check-label" for="discloseFax">Disclose in WHOIS</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Email -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label required">Email</label>
|
||||||
|
<input type="email" class="form-control" id="email" name="email" required="required" autocapitalize="none" value="{{ contact.email }}">
|
||||||
|
<label class="form-check form-switch mt-1">
|
||||||
|
<input class="form-check-input" type="checkbox" id="discloseEmail" name="disclose_email" {% if contact.disclose_email == '1' %}checked{% endif %}>
|
||||||
|
<span class="form-check-label" for="discloseEmail">Disclose in WHOIS</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- AuthInfo for Contact -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="authInfo" class="form-label required">Contact AuthInfo</label>
|
||||||
|
<input type="text" class="form-control" id="authInfo" name="authInfo" value="{{ contactAuth.authinfo }}">
|
||||||
|
<small class="form-text text-muted">Authentication information for the contact.</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- NIN - National Identification Number -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="nin" class="form-label">NIN - National Identification Number</label>
|
||||||
|
<input type="text" class="form-control" id="nin" name="nin" value="{{ contact.nin }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Personal or Business Checkbox -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" id="isBusiness" name="isBusiness">
|
||||||
|
<label class="form-check-label" for="isBusiness">This is a Business Contact</label>
|
||||||
|
</div>
|
||||||
|
<!-- You can invert the logic if you prefer the default to be 'Personal' instead of 'Business' -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" id="verifyPhone" name="verifyPhone">
|
||||||
|
<label class="form-check-label" for="verifyPhone">Verify by Phone</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" id="verifyEmail" name="verifyEmail">
|
||||||
|
<label class="form-check-label" for="verifyEmail">Verify by Email</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" id="verifyPostal" name="verifyPostal">
|
||||||
|
<label class="form-check-label" for="verifyPostal">Verify by Postal Mail</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Localized Info Checkbox -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" id="toggleLoc" {% if postal_loc.cc %}checked{% endif %}>
|
||||||
|
<span class="form-check-label" for="toggleLoc">Include Localized Info</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Hidden Localized Info Rows -->
|
||||||
|
<div class="row" id="localizedInfo" style="display: none;">
|
||||||
|
<!-- Localized Postal Info: First Column -->
|
||||||
|
<div class="col-md-6">
|
||||||
|
<h6 class="mb-3">Localized Postal Info: Personal Details</h6>
|
||||||
|
|
||||||
|
<!-- Localized Name -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="locName" class="form-label">Name</label>
|
||||||
|
<input type="text" class="form-control" id="locName" name="locName" value="{{ postal_loc.name }}">
|
||||||
|
<label class="form-check form-switch mt-1">
|
||||||
|
<input class="form-check-input" type="checkbox" id="discloseNameLoc" name="disclose_name_loc" {% if postal_loc.disclose_name_loc == '1' %}checked{% endif %}>
|
||||||
|
<span class="form-check-label" for="discloseNameLoc">Disclose in WHOIS</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Localized Organization -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="locOrg" class="form-label">Organization</label>
|
||||||
|
<input type="text" class="form-control" id="locOrg" name="locOrg" value="{{ postal_loc.org }}">
|
||||||
|
<label class="form-check form-switch mt-1">
|
||||||
|
<input class="form-check-input" type="checkbox" id="discloseOrgLoc" name="disclose_org_loc" {% if postal_loc.disclose_org_loc == '1' %}checked{% endif %}>
|
||||||
|
<span class="form-check-label" for="discloseOrgLoc">Disclose in WHOIS</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Localized Street Details -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="locStreet1" class="form-label">Street 1</label>
|
||||||
|
<input type="text" class="form-control" id="locStreet1" name="locStreet1" value="{{ postal_loc.street1 }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="locStreet2" class="form-label">Street 2</label>
|
||||||
|
<input type="text" class="form-control" id="locStreet2" name="locStreet2" value="{{ postal_loc.street2 }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Localized Postal Info: Second Column -->
|
||||||
|
<div class="col-md-6">
|
||||||
|
<h6 class="mb-3">Localized Postal Info: Address Details</h6>
|
||||||
|
|
||||||
|
<!-- Continued Localized Street Detail -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="locStreet3" class="form-label">Street 3</label>
|
||||||
|
<input type="text" class="form-control" id="locStreet3" name="locStreet3" value="{{ postal_loc.street3 }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Localized City, SP, PC, CC -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="locCity" class="form-label">City</label>
|
||||||
|
<input type="text" class="form-control" id="locCity" name="locCity" value="{{ postal_loc.city }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="locSP" class="form-label">State/Province</label>
|
||||||
|
<input type="text" class="form-control" id="locSP" name="locSP" value="{{ postal_loc.sp }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="locPC" class="form-label">Postal Code</label>
|
||||||
|
<input type="text" class="form-control" id="locPC" name="locPC" value="{{ postal_loc.pc }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="locCC" class="form-label">Country</label>
|
||||||
|
<select class="form-select" id="locCC" name="locCC">
|
||||||
|
{% for country in countries %}
|
||||||
|
<option value="{{ country.alpha2|lower }}" {% if postal_loc.cc == country.alpha2 %}selected{% endif %}>{{ country.name }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<label class="form-check form-switch mt-1">
|
||||||
|
<input class="form-check-input" type="checkbox" id="discloseAddrLoc" name="disclose_addr_loc" {% if postal_loc.disclose_addr_loc == '1' %}checked{% endif %}>
|
||||||
|
<span class="form-check-label" for="discloseAddrLoc">Disclose Address in WHOIS</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-auto">
|
||||||
|
<button type="submit" class="btn btn-primary">Update Contact</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer class="footer footer-transparent d-print-none">
|
||||||
|
<div class="container-xl">
|
||||||
|
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
|
||||||
|
<ul class="list-inline list-inline-dots mb-0">
|
||||||
|
<li class="list-inline-item">
|
||||||
|
Copyright © 2023
|
||||||
|
<a href="https://namingo.org" target="_blank" class="link-secondary">Namingo</a>.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
const toggleLocCheckbox = document.getElementById('toggleLoc');
|
||||||
|
const localizedSection = document.getElementById('localizedInfo');
|
||||||
|
|
||||||
|
// Function to toggle the visibility of the extra data
|
||||||
|
function toggleLocalizedSection() {
|
||||||
|
if (toggleLocCheckbox.checked) {
|
||||||
|
localizedSection.style.display = "flex";
|
||||||
|
} else {
|
||||||
|
localizedSection.style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Event listener for checkbox state change
|
||||||
|
toggleLocCheckbox.addEventListener('change', toggleLocalizedSection);
|
||||||
|
|
||||||
|
// Call the function on page load to set the initial state
|
||||||
|
toggleLocalizedSection();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
|
@ -21,7 +21,7 @@
|
||||||
function actionsFormatter(cell, formatterParams, onRendered) {
|
function actionsFormatter(cell, formatterParams, onRendered) {
|
||||||
return `
|
return `
|
||||||
<a class="btn btn-primary btn-icon update-btn" href="contact/update/${cell.getRow().getData().identifier}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"></path><path d="M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"></path><path d="M16 5l3 3"></path></svg></a>
|
<a class="btn btn-primary btn-icon update-btn" href="contact/update/${cell.getRow().getData().identifier}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"></path><path d="M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"></path><path d="M16 5l3 3"></path></svg></a>
|
||||||
<button class="btn btn-danger btn-icon delete-btn" data-id="${cell.getRow().getData().id}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7h16"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path><path d="M10 12l4 4m0 -4l-4 4"></path></svg></button>
|
<a class="btn btn-danger btn-icon delete-btn" href="contact/delete/${cell.getRow().getData().identifier}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7h16"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path><path d="M10 12l4 4m0 -4l-4 4"></path></svg></a>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue