Universal Acceptance Update (3/3)

This commit is contained in:
Pinga 2024-11-01 13:58:24 +02:00
parent f60b59b00b
commit be965db4cc
5 changed files with 78 additions and 38 deletions

View file

@ -67,9 +67,9 @@ class RegistrarsController extends Controller
'owner' => v::optional(v::keySet(...$contactValidator)),
'billing' => v::optional(v::keySet(...$contactValidator)),
'abuse' => v::optional(v::keySet(...$contactValidator)),
'whoisServer' => v::domain(),
'rdapServer' => v::domain(),
'url' => v::url(),
'whoisServer' => v::domain(false),
'rdapServer' => v::domain(false),
'url' => v::domain(false),
'abuseEmail' => v::email(),
'abusePhone' => v::optional($phoneValidator),
'accountBalance' => v::numericVal(),
@ -85,6 +85,11 @@ class RegistrarsController extends Controller
'panelPassword' => v::stringType()->notEmpty(),
];
// Convert specified fields to Punycode if necessary
$data['whoisServer'] = isset($data['whoisServer']) ? toPunycode($data['whoisServer']) : null;
$data['rdapServer'] = isset($data['rdapServer']) ? toPunycode($data['rdapServer']) : null;
$data['url'] = isset($data['url']) ? toPunycode($data['url']) : null;
$errors = [];
foreach ($validators as $field => $validator) {
try {
@ -138,9 +143,9 @@ class RegistrarsController extends Controller
'pw' => $eppPassword,
'prefix' => $randomPrefix,
'email' => $data['email'],
'url' => $data['url'],
'whois_server' => $data['whoisServer'],
'rdap_server' => $data['rdapServer'],
'url' => isset($data['url']) ? toUnicode($data['url']) : null,
'whois_server' => isset($data['whoisServer']) ? toUnicode($data['whoisServer']) : null,
'rdap_server' => isset($data['rdapServer']) ? toUnicode($data['rdapServer']) : null,
'abuse_email' => $data['abuseEmail'],
'abuse_phone' => $data['abusePhone'],
'accountBalance' => $data['accountBalance'],
@ -565,9 +570,9 @@ class RegistrarsController extends Controller
'owner' => v::optional(v::keySet(...$contactValidator)),
'billing' => v::optional(v::keySet(...$contactValidator)),
'abuse' => v::optional(v::keySet(...$contactValidator)),
'whoisServer' => v::domain(),
'rdapServer' => v::domain(),
'url' => v::url(),
'whoisServer' => v::domain(false),
'rdapServer' => v::domain(false),
'url' => v::domain(false),
'abuseEmail' => v::email(),
'abusePhone' => v::optional($phoneValidator),
'creditLimit' => v::numericVal(),
@ -575,6 +580,11 @@ class RegistrarsController extends Controller
'ipAddress' => v::optional($ipAddressValidator)
];
// Convert specified fields to Punycode if necessary
$data['whoisServer'] = isset($data['whoisServer']) ? toPunycode($data['whoisServer']) : null;
$data['rdapServer'] = isset($data['rdapServer']) ? toPunycode($data['rdapServer']) : null;
$data['url'] = isset($data['url']) ? toPunycode($data['url']) : null;
$errors = [];
foreach ($validators as $field => $validator) {
try {
@ -596,14 +606,14 @@ class RegistrarsController extends Controller
$errorText = rtrim($errorText, '; ');
$this->container->get('flash')->addMessage('error', $errorText);
return $response->withHeader('Location', '/registrars')->withStatus(302);
return $response->withHeader('Location', '/registrar/update/'.$registrar)->withStatus(302);
}
if (!empty($_SESSION['registrars_user_email'])) {
$regEmail = $_SESSION['registrars_user_email'][0];
} else {
$this->container->get('flash')->addMessage('error', 'No email specified for update');
return $response->withHeader('Location', '/registrars')->withStatus(302);
return $response->withHeader('Location', '/registrar/update/'.$registrar)->withStatus(302);
}
$db->beginTransaction();
@ -621,9 +631,9 @@ class RegistrarsController extends Controller
'name' => $data['name'],
'iana_id' => $data['ianaId'],
'email' => $data['email'],
'url' => $data['url'],
'whois_server' => $data['whoisServer'],
'rdap_server' => $data['rdapServer'],
'url' => isset($data['url']) ? toUnicode($data['url']) : null,
'whois_server' => isset($data['whoisServer']) ? toUnicode($data['whoisServer']) : null,
'rdap_server' => isset($data['rdapServer']) ? toUnicode($data['rdapServer']) : null,
'abuse_email' => $data['abuseEmail'],
'abuse_phone' => $data['abusePhone'],
'creditLimit' => $data['creditLimit'],
@ -807,13 +817,18 @@ class RegistrarsController extends Controller
'owner' => v::optional(v::keySet(...$contactValidator)),
'billing' => v::optional(v::keySet(...$contactValidator)),
'abuse' => v::optional(v::keySet(...$contactValidator)),
'whoisServer' => v::domain(),
'rdapServer' => v::domain(),
'url' => v::url(),
'whoisServer' => v::domain(false),
'rdapServer' => v::domain(false),
'url' => v::domain(false),
'abuseEmail' => v::email(),
'abusePhone' => v::optional($phoneValidator),
'ipAddress' => v::optional($ipAddressValidator)
];
// Convert specified fields to Punycode if necessary
$data['whoisServer'] = isset($data['whoisServer']) ? toPunycode($data['whoisServer']) : null;
$data['rdapServer'] = isset($data['rdapServer']) ? toPunycode($data['rdapServer']) : null;
$data['url'] = isset($data['url']) ? toPunycode($data['url']) : null;
$errors = [];
foreach ($validators as $field => $validator) {
@ -861,9 +876,9 @@ class RegistrarsController extends Controller
'name' => $data['name'],
'iana_id' => $data['ianaId'],
'email' => $data['email'],
'url' => $data['url'],
'whois_server' => $data['whoisServer'],
'rdap_server' => $data['rdapServer'],
'url' => isset($data['url']) ? toUnicode($data['url']) : null,
'whois_server' => isset($data['whoisServer']) ? toUnicode($data['whoisServer']) : null,
'rdap_server' => isset($data['rdapServer']) ? toUnicode($data['rdapServer']) : null,
'abuse_email' => $data['abuseEmail'],
'abuse_phone' => $data['abusePhone'],
'currency' => $currency,