mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-15 09:07:00 +02:00
Universal Acceptance Update (3/3)
This commit is contained in:
parent
f60b59b00b
commit
be965db4cc
5 changed files with 78 additions and 38 deletions
|
@ -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,
|
||||
|
|
|
@ -576,4 +576,14 @@ function validateUniversalEmail($email) {
|
|||
|
||||
// Validate using regex
|
||||
return preg_match($emailPattern, $emailToValidate);
|
||||
}
|
||||
|
||||
function toPunycode($value) {
|
||||
// Convert to Punycode if it contains non-ASCII characters
|
||||
return preg_match('/[^\x00-\x7F]/', $value) ? idn_to_ascii($value, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46) : $value;
|
||||
}
|
||||
|
||||
function toUnicode($value) {
|
||||
// Convert from Punycode to UTF-8 if it's a valid IDN format
|
||||
return (strpos($value, 'xn--') === 0) ? idn_to_utf8($value, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46) : $value;
|
||||
}
|
|
@ -46,12 +46,17 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label required">{{ __('Email') }}</label>
|
||||
<input type="email" class="form-control" id="email" name="email" required autocapitalize="none">
|
||||
<input type="text" class="form-control" id="email" name="email" required autocapitalize="none">
|
||||
<small class="text-muted">{{ __('Primary contact email of the registrar.') }}</small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="url" class="form-label required">{{ __('URL') }}</label>
|
||||
<input type="url" class="form-control" id="url" name="url" required autocapitalize="none">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">
|
||||
https://
|
||||
</span>
|
||||
<input type="text" class="form-control" id="url" name="url" required autocapitalize="none">
|
||||
</div>
|
||||
<small class="text-muted">{{ __('Registrar\'s official website URL.') }}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -70,7 +75,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="abuseEmail" class="form-label required">{{ __('Abuse Email') }}</label>
|
||||
<input type="email" class="form-control" id="abuseEmail" name="abuseEmail" required autocapitalize="none">
|
||||
<input type="text" class="form-control" id="abuseEmail" name="abuseEmail" required autocapitalize="none">
|
||||
<small class="text-muted">{{ __('Email address for reporting abuse.') }}</small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
|
@ -212,7 +217,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="ownerEmail" class="form-label required">{{ __('Email') }}</label>
|
||||
<input type="email" class="form-control" id="ownerEmail" name="owner[email]" required autocapitalize="none">
|
||||
<input type="text" class="form-control" id="ownerEmail" name="owner[email]" required autocapitalize="none">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -271,7 +276,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="billingEmail" class="form-label required">{{ __('Email') }}</label>
|
||||
<input type="email" class="form-control" id="billingEmail" name="billing[email]" required autocapitalize="none">
|
||||
<input type="text" class="form-control" id="billingEmail" name="billing[email]" required autocapitalize="none">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -330,7 +335,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="abuseEmail" class="form-label required">{{ __('Email') }}</label>
|
||||
<input type="email" class="form-control" id="abuseEmail" name="abuse[email]" required autocapitalize="none">
|
||||
<input type="text" class="form-control" id="abuseEmail" name="abuse[email]" required autocapitalize="none">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -46,12 +46,17 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label required">{{ __('Email') }}</label>
|
||||
<input type="email" class="form-control" id="email" name="email" required autocapitalize="none" value="{{ registrar.email }}">
|
||||
<input type="text" class="form-control" id="email" name="email" required autocapitalize="none" value="{{ registrar.email }}">
|
||||
<small class="text-muted">{{ __('Primary contact email of the registrar.') }}</small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="url" class="form-label required">{{ __('URL') }}</label>
|
||||
<input type="url" class="form-control" id="url" name="url" required autocapitalize="none" value="{{ registrar.url }}">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">
|
||||
https://
|
||||
</span>
|
||||
<input type="text" class="form-control" id="url" name="url" required autocapitalize="none" value="{{ registrar.url }}">
|
||||
</div>
|
||||
<small class="text-muted">{{ __('Registrar\'s official website URL.') }}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -70,7 +75,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="abuseEmail" class="form-label required">{{ __('Abuse Email') }}</label>
|
||||
<input type="email" class="form-control" id="abuseEmail" name="abuseEmail" required autocapitalize="none" value="{{ registrar.abuse_email }}">
|
||||
<input type="text" class="form-control" id="abuseEmail" name="abuseEmail" required autocapitalize="none" value="{{ registrar.abuse_email }}">
|
||||
<small class="text-muted">{{ __('Email address for reporting abuse.') }}</small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
|
@ -211,7 +216,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="ownerEmail" class="form-label required">{{ __('Email') }}</label>
|
||||
<input type="email" class="form-control" id="ownerEmail" name="owner[email]" required autocapitalize="none" value="{{ contact.email }}">
|
||||
<input type="text" class="form-control" id="ownerEmail" name="owner[email]" required autocapitalize="none" value="{{ contact.email }}">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -274,7 +279,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="billingEmail" class="form-label required">{{ __('Email') }}</label>
|
||||
<input type="email" class="form-control" id="billingEmail" name="billing[email]" required autocapitalize="none" value="{{ contact.email }}">
|
||||
<input type="text" class="form-control" id="billingEmail" name="billing[email]" required autocapitalize="none" value="{{ contact.email }}">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -337,7 +342,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="abuseEmail" class="form-label required">{{ __('Email') }}</label>
|
||||
<input type="email" class="form-control" id="abuseEmail" name="abuse[email]" required autocapitalize="none" value="{{ contact.email }}">
|
||||
<input type="text" class="form-control" id="abuseEmail" name="abuse[email]" required autocapitalize="none" value="{{ contact.email }}">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
|
@ -46,12 +46,17 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label required">{{ __('Email') }}</label>
|
||||
<input type="email" class="form-control" id="email" name="email" required autocapitalize="none" value="{{ registrar.email }}">
|
||||
<input type="text" class="form-control" id="email" name="email" required autocapitalize="none" value="{{ registrar.email }}">
|
||||
<small class="text-muted">{{ __('Primary contact email of the registrar.') }}</small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="url" class="form-label required">{{ __('URL') }}</label>
|
||||
<input type="url" class="form-control" id="url" name="url" required autocapitalize="none" value="{{ registrar.url }}">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">
|
||||
https://
|
||||
</span>
|
||||
<input type="text" class="form-control" id="url" name="url" required autocapitalize="none" value="{{ registrar.url }}">
|
||||
</div>
|
||||
<small class="text-muted">{{ __('Registrar\'s official website URL.') }}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -70,7 +75,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="abuseEmail" class="form-label required">{{ __('Abuse Email') }}</label>
|
||||
<input type="email" class="form-control" id="abuseEmail" name="abuseEmail" required autocapitalize="none" value="{{ registrar.abuse_email }}">
|
||||
<input type="text" class="form-control" id="abuseEmail" name="abuseEmail" required autocapitalize="none" value="{{ registrar.abuse_email }}">
|
||||
<small class="text-muted">{{ __('Email address for reporting abuse.') }}</small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
|
@ -211,7 +216,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="ownerEmail" class="form-label required">{{ __('Email') }}</label>
|
||||
<input type="email" class="form-control" id="ownerEmail" name="owner[email]" required autocapitalize="none" value="{{ contact.email }}">
|
||||
<input type="text" class="form-control" id="ownerEmail" name="owner[email]" required autocapitalize="none" value="{{ contact.email }}">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -274,7 +279,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="billingEmail" class="form-label required">{{ __('Email') }}</label>
|
||||
<input type="email" class="form-control" id="billingEmail" name="billing[email]" required autocapitalize="none" value="{{ contact.email }}">
|
||||
<input type="text" class="form-control" id="billingEmail" name="billing[email]" required autocapitalize="none" value="{{ contact.email }}">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -337,7 +342,7 @@
|
|||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="abuseEmail" class="form-label required">{{ __('Email') }}</label>
|
||||
<input type="email" class="form-control" id="abuseEmail" name="abuse[email]" required autocapitalize="none" value="{{ contact.email }}">
|
||||
<input type="text" class="form-control" id="abuseEmail" name="abuse[email]" required autocapitalize="none" value="{{ contact.email }}">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue