This commit is contained in:
Pinga 2023-12-30 13:12:23 +02:00
parent 4cf0d8c5dd
commit f6fac77710
2 changed files with 109 additions and 12 deletions

View file

@ -97,6 +97,7 @@ class DomainsController extends Controller
} else { } else {
$registrar = null; $registrar = null;
} }
$launch_phases = $db->selectValue("SELECT value FROM settings WHERE name = 'launch_phases'");
$registrationYears = $data['registrationYears']; $registrationYears = $data['registrationYears'];
@ -105,9 +106,9 @@ class DomainsController extends Controller
$contactTech = $data['contactTech'] ?? null; $contactTech = $data['contactTech'] ?? null;
$contactBilling = $data['contactBilling'] ?? null; $contactBilling = $data['contactBilling'] ?? null;
$phaseType = $data['phaseType'] ?? 'NONE'; $phaseType = $data['phaseType'] ?? 'none';
$smd = $data['smd'] ?? null; $smd = $data['smd'] ?? null;
$nameservers = !empty($data['nameserver']) ? $data['nameserver'] : null; $nameservers = !empty($data['nameserver']) ? $data['nameserver'] : null;
$nameserver_ipv4 = !empty($data['nameserver_ipv4']) ? $data['nameserver_ipv4'] : null; $nameserver_ipv4 = !empty($data['nameserver_ipv4']) ? $data['nameserver_ipv4'] : null;
$nameserver_ipv6 = !empty($data['nameserver_ipv6']) ? $data['nameserver_ipv6'] : null; $nameserver_ipv6 = !empty($data['nameserver_ipv6']) ? $data['nameserver_ipv6'] : null;
@ -135,6 +136,7 @@ class DomainsController extends Controller
'error' => 'Invalid domain name', 'error' => 'Invalid domain name',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -155,6 +157,7 @@ class DomainsController extends Controller
'error' => 'Invalid domain extension', 'error' => 'Invalid domain extension',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -169,6 +172,7 @@ class DomainsController extends Controller
'error' => 'Domain name already exists', 'error' => 'Domain name already exists',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -187,21 +191,66 @@ class DomainsController extends Controller
); );
if ($phase_details !== 'First-Come-First-Serve') { if ($phase_details !== 'First-Come-First-Serve') {
if ($phaseType !== 'none') {
if ($phaseType == null && $phaseType == '') {
return view($response, 'admin/domains/createDomain.twig', [
'domainName' => $domainName,
'error' => 'The launch phase ' . $phaseType . ' is improperly configured. Please check the settings or contact support.',
'registrars' => $registrars,
'registrar' => $registrar,
'launch_phases' => $launch_phases
]);
} else if ($phase_details == null) {
return view($response, 'admin/domains/createDomain.twig', [
'domainName' => $domainName,
'error' => 'The launch phase ' . $phaseType . ' is currently not active.',
'registrars' => $registrars,
'registrar' => $registrar,
'launch_phases' => $launch_phases
]);
}
}
} else if ($phaseType !== 'none') {
if ($phaseType == null && $phaseType == '') { if ($phaseType == null && $phaseType == '') {
return view($response, 'admin/domains/createDomain.twig', [ return view($response, 'admin/domains/createDomain.twig', [
'domainName' => $domainName, 'domainName' => $domainName,
'error' => 'The launch phase ' . $phaseType . ' is improperly configured. Please check the settings or contact support.', 'error' => 'The launch phase ' . $phaseType . ' is improperly configured. Please check the settings or contact support.',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]);
} else if ($phase_details == null) {
return view($response, 'admin/domains/createDomain.twig', [
'domainName' => $domainName,
'error' => 'The launch phase ' . $phaseType . ' is currently not active.',
'registrars' => $registrars,
'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
} else if ($phaseType == null && $phaseType == '') { }
return view($response, 'admin/domains/createDomain.twig', [
'domainName' => $domainName, if ($phaseType === 'claims') {
'error' => 'The launch phase ' . $phaseType . ' is improperly configured. Please check the settings or contact support.', if (!isset($data['noticeid']) || $data['noticeid'] === '' ||
'registrars' => $registrars, !isset($data['notafter']) || $data['notafter'] === '' ||
'registrar' => $registrar, !isset($data['accepted']) || $data['accepted'] === '') {
]); // Trigger an error or handle the situation as needed
return view($response, 'admin/domains/createDomain.twig', [
'domainName' => $domainName,
'error' => "Error: 'noticeid', 'notafter', or 'accepted' cannot be empty when phaseType is 'claims'",
'registrars' => $registrars,
'registrar' => $registrar,
'launch_phases' => $launch_phases
]);
}
$noticeid = $data['noticeid'];
$notafter = $data['notafter'];
$accepted = $data['accepted'];
} else {
$noticeid = null;
$notafter = null;
$accepted = null;
} }
$domain_already_reserved = $db->selectValue( $domain_already_reserved = $db->selectValue(
@ -215,6 +264,7 @@ class DomainsController extends Controller
'error' => 'Domain name is reserved or restricted', 'error' => 'Domain name is reserved or restricted',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -224,6 +274,7 @@ class DomainsController extends Controller
'error' => 'Domain period must be from 1 to 10', 'error' => 'Domain period must be from 1 to 10',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} elseif (!$registrationYears) { } elseif (!$registrationYears) {
$registrationYears = 1; $registrationYears = 1;
@ -254,6 +305,7 @@ class DomainsController extends Controller
'error' => 'The price, period and currency for such TLD are not declared', 'error' => 'The price, period and currency for such TLD are not declared',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -263,6 +315,7 @@ class DomainsController extends Controller
'error' => 'Low credit: minimum threshold reached', 'error' => 'Low credit: minimum threshold reached',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -283,6 +336,7 @@ class DomainsController extends Controller
'error' => 'Duplicate nameservers detected. Please provide unique nameservers.', 'error' => 'Duplicate nameservers detected. Please provide unique nameservers.',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -293,6 +347,7 @@ class DomainsController extends Controller
'error' => 'Invalid hostName', 'error' => 'Invalid hostName',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -302,6 +357,7 @@ class DomainsController extends Controller
'error' => 'Invalid hostName', 'error' => 'Invalid hostName',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
} }
@ -317,6 +373,7 @@ class DomainsController extends Controller
'error' => 'Registrant does not exist', 'error' => 'Registrant does not exist',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -326,6 +383,7 @@ class DomainsController extends Controller
'error' => 'The contact requested in the command does NOT belong to the current registrar', 'error' => 'The contact requested in the command does NOT belong to the current registrar',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
} }
@ -340,6 +398,7 @@ class DomainsController extends Controller
'error' => 'Admin contact does not exist', 'error' => 'Admin contact does not exist',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -349,6 +408,7 @@ class DomainsController extends Controller
'error' => 'The contact requested in the command does NOT belong to the current registrar', 'error' => 'The contact requested in the command does NOT belong to the current registrar',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
} }
@ -363,6 +423,7 @@ class DomainsController extends Controller
'error' => 'Tech contact does not exist', 'error' => 'Tech contact does not exist',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -372,6 +433,7 @@ class DomainsController extends Controller
'error' => 'The contact requested in the command does NOT belong to the current registrar', 'error' => 'The contact requested in the command does NOT belong to the current registrar',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
} }
@ -386,6 +448,7 @@ class DomainsController extends Controller
'error' => 'Billing contact does not exist', 'error' => 'Billing contact does not exist',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -395,6 +458,7 @@ class DomainsController extends Controller
'error' => 'The contact requested in the command does NOT belong to the current registrar', 'error' => 'The contact requested in the command does NOT belong to the current registrar',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
} }
@ -405,6 +469,7 @@ class DomainsController extends Controller
'error' => 'Missing domain authinfo', 'error' => 'Missing domain authinfo',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -414,6 +479,7 @@ class DomainsController extends Controller
'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,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -423,6 +489,7 @@ class DomainsController extends Controller
'error' => 'Password should have both upper and lower case characters', 'error' => 'Password should have both upper and lower case characters',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -460,7 +527,10 @@ class DomainsController extends Controller
'rgpstatus' => 'addPeriod', 'rgpstatus' => 'addPeriod',
'addPeriod' => $date_add, 'addPeriod' => $date_add,
'tm_phase' => $phaseType, 'tm_phase' => $phaseType,
'tm_smd_id' => $smd 'tm_smd_id' => $smd,
'tm_notice_id' => $noticeid,
'tm_notice_accepted' => $accepted,
'tm_notice_expires' => $notafter
]); ]);
$domain_id = $db->getlastInsertId(); $domain_id = $db->getlastInsertId();
@ -529,6 +599,7 @@ class DomainsController extends Controller
'error' => 'Incomplete key tag provided', 'error' => 'Incomplete key tag provided',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -538,6 +609,7 @@ class DomainsController extends Controller
'error' => 'Incomplete key tag provided', 'error' => 'Incomplete key tag provided',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
} }
@ -550,6 +622,7 @@ class DomainsController extends Controller
'error' => 'Incomplete algorithm provided', 'error' => 'Incomplete algorithm provided',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -560,6 +633,7 @@ class DomainsController extends Controller
'error' => 'Incomplete digest type provided', 'error' => 'Incomplete digest type provided',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
$validDigests = [ $validDigests = [
@ -573,6 +647,7 @@ class DomainsController extends Controller
'error' => 'Invalid digest length or format', 'error' => 'Invalid digest length or format',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
} }
@ -586,6 +661,7 @@ class DomainsController extends Controller
'error' => 'Invalid flags provided', 'error' => 'Invalid flags provided',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -596,6 +672,7 @@ class DomainsController extends Controller
'error' => 'Invalid protocol provided', 'error' => 'Invalid protocol provided',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -606,6 +683,7 @@ class DomainsController extends Controller
'error' => 'Invalid algorithm encoding', 'error' => 'Invalid algorithm encoding',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -616,6 +694,7 @@ class DomainsController extends Controller
'error' => 'Invalid public key encoding', 'error' => 'Invalid public key encoding',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -777,6 +856,7 @@ class DomainsController extends Controller
'error' => 'Error: No IPv4 or IPv6 addresses provided for internal host', 'error' => 'Error: No IPv4 or IPv6 addresses provided for internal host',
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }
@ -867,6 +947,7 @@ class DomainsController extends Controller
'error' => 'Database failure: ' . $e->getMessage(), 'error' => 'Database failure: ' . $e->getMessage(),
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} catch (\Pinga\Db\Throwable\IntegrityConstraintViolationException $e) { } catch (\Pinga\Db\Throwable\IntegrityConstraintViolationException $e) {
$db->rollBack(); $db->rollBack();
@ -875,6 +956,7 @@ class DomainsController extends Controller
'error' => 'Database failure: ' . $e->getMessage(), 'error' => 'Database failure: ' . $e->getMessage(),
'registrars' => $registrars, 'registrars' => $registrars,
'registrar' => $registrar, 'registrar' => $registrar,
'launch_phases' => $launch_phases
]); ]);
} }

View file

@ -223,7 +223,7 @@
<div class="mb-3"> <div class="mb-3">
<label for="phaseType" class="form-label">Phase Type</label> <label for="phaseType" class="form-label">Phase Type</label>
<select class="form-select" id="phaseType" name="phaseType"> <select class="form-select" id="phaseType" name="phaseType">
<option value="">N/A</option> <option value="none">N/A</option>
<option value="sunrise">Sunrise</option> <option value="sunrise">Sunrise</option>
<option value="landrush">Landrush</option> <option value="landrush">Landrush</option>
<option value="claims">Claims</option> <option value="claims">Claims</option>
@ -231,11 +231,26 @@
<option value="custom">Custom</option> <option value="custom">Custom</option>
</select> </select>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Signed Mark Information</label> <label class="form-label">Signed Mark Information</label>
<textarea class="form-control" data-bs-toggle="autosize" name="smd" placeholder="Paste SMD contents…"></textarea> <textarea class="form-control" data-bs-toggle="autosize" name="smd" placeholder="Paste SMD contents…"></textarea>
</div> </div>
<div class="mb-3">
<label for="noticeid" class="form-label">{{ __('Notice ID') }}</label>
<input type="text" class="form-control" name="noticeid">
</div>
<div class="mb-3">
<label for="notafter" class="form-label">{{ __('Not After Date') }}</label>
<input type="datetime-local" class="form-control" name="notafter">
</div>
<div class="mb-3">
<label for="accepted" class="form-label">{{ __('Accepted Date') }}</label>
<input type="datetime-local" class="form-control" name="accepted">
</div>
{% endif %} {% endif %}
</div> </div>