mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-13 16:16:59 +02:00
More bugfixes
This commit is contained in:
parent
abde99e73e
commit
439995baaf
5 changed files with 27 additions and 21 deletions
|
@ -71,10 +71,6 @@ class ApplicationsController extends Controller
|
||||||
$nameserver_ipv6 = !empty($data['nameserver_ipv6']) ? $data['nameserver_ipv6'] : null;
|
$nameserver_ipv6 = !empty($data['nameserver_ipv6']) ? $data['nameserver_ipv6'] : null;
|
||||||
|
|
||||||
$authInfo = $data['authInfo'] ?? null;
|
$authInfo = $data['authInfo'] ?? null;
|
||||||
|
|
||||||
$parts = extractDomainAndTLD($domainName);
|
|
||||||
$label = $parts['domain'];
|
|
||||||
$domain_extension = $parts['tld'];
|
|
||||||
$invalid_domain = validate_label($domainName, $db);
|
$invalid_domain = validate_label($domainName, $db);
|
||||||
|
|
||||||
if ($invalid_domain) {
|
if ($invalid_domain) {
|
||||||
|
@ -82,6 +78,10 @@ class ApplicationsController extends Controller
|
||||||
return $response->withHeader('Location', '/application/create')->withStatus(302);
|
return $response->withHeader('Location', '/application/create')->withStatus(302);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$parts = extractDomainAndTLD($domainName);
|
||||||
|
$label = $parts['domain'];
|
||||||
|
$domain_extension = $parts['tld'];
|
||||||
|
|
||||||
$valid_tld = false;
|
$valid_tld = false;
|
||||||
$result = $db->select('SELECT id, tld FROM domain_tld');
|
$result = $db->select('SELECT id, tld FROM domain_tld');
|
||||||
|
|
||||||
|
|
|
@ -169,6 +169,12 @@ class DomainsController extends Controller
|
||||||
$dnskeyPubKey = $data['dnskeyPubKey'] ?? null;
|
$dnskeyPubKey = $data['dnskeyPubKey'] ?? null;
|
||||||
|
|
||||||
$authInfo = $data['authInfo'] ?? null;
|
$authInfo = $data['authInfo'] ?? null;
|
||||||
|
$invalid_domain = validate_label($domainName, $db);
|
||||||
|
|
||||||
|
if ($invalid_domain) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Error creating domain: Invalid domain name');
|
||||||
|
return $response->withHeader('Location', '/domain/create')->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$parts = extractDomainAndTLD($domainName);
|
$parts = extractDomainAndTLD($domainName);
|
||||||
|
@ -179,12 +185,6 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
$label = $parts['domain'];
|
$label = $parts['domain'];
|
||||||
$domain_extension = $parts['tld'];
|
$domain_extension = $parts['tld'];
|
||||||
$invalid_domain = validate_label($domainName, $db);
|
|
||||||
|
|
||||||
if ($invalid_domain) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Error creating domain: Invalid domain name');
|
|
||||||
return $response->withHeader('Location', '/domain/create')->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
$valid_tld = false;
|
$valid_tld = false;
|
||||||
$result = $db->select('SELECT id, tld FROM domain_tld');
|
$result = $db->select('SELECT id, tld FROM domain_tld');
|
||||||
|
@ -761,7 +761,7 @@ class DomainsController extends Controller
|
||||||
$host_date = $currentDateTime->format('Y-m-d H:i:s.v');
|
$host_date = $currentDateTime->format('Y-m-d H:i:s.v');
|
||||||
|
|
||||||
if ($internal_host) {
|
if ($internal_host) {
|
||||||
if (strpos(strtolower($nameserver), strtolower($domainName)) !== false) {
|
if (str_ends_with(strtolower(trim($nameserver)), strtolower(trim($domainName)))) {
|
||||||
$db->insert(
|
$db->insert(
|
||||||
'host',
|
'host',
|
||||||
[
|
[
|
||||||
|
|
|
@ -209,6 +209,9 @@ function validate_label($label, $db) {
|
||||||
if (strlen($label) < 2) {
|
if (strlen($label) < 2) {
|
||||||
return 'Total lenght of your domain must be greater then 2 characters';
|
return 'Total lenght of your domain must be greater then 2 characters';
|
||||||
}
|
}
|
||||||
|
if (strpos($label, '.') === false) {
|
||||||
|
return 'Invalid domain name format, must contain at least one dot (.)';
|
||||||
|
}
|
||||||
if (strpos($label, 'xn--') === false && preg_match("/(^-|^\.|-\.|\.-|--|\.\.|-$|\.$)/", $label)) {
|
if (strpos($label, 'xn--') === false && preg_match("/(^-|^\.|-\.|\.-|--|\.\.|-$|\.$)/", $label)) {
|
||||||
return 'Invalid domain name format, cannot begin or end with a hyphen (-)';
|
return 'Invalid domain name format, cannot begin or end with a hyphen (-)';
|
||||||
}
|
}
|
||||||
|
|
|
@ -640,10 +640,6 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = extractDomainAndTLD($domainName);
|
|
||||||
$label = $parts['domain'];
|
|
||||||
$domain_extension = $parts['tld'];
|
|
||||||
|
|
||||||
$invalid_domain = validate_label($domainName, $db);
|
$invalid_domain = validate_label($domainName, $db);
|
||||||
|
|
||||||
if ($invalid_domain) {
|
if ($invalid_domain) {
|
||||||
|
@ -651,6 +647,10 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$parts = extractDomainAndTLD($domainName);
|
||||||
|
$label = $parts['domain'];
|
||||||
|
$domain_extension = $parts['tld'];
|
||||||
|
|
||||||
$valid_tld = false;
|
$valid_tld = false;
|
||||||
$stmt = $db->prepare("SELECT id, tld FROM domain_tld");
|
$stmt = $db->prepare("SELECT id, tld FROM domain_tld");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
|
@ -191,6 +191,9 @@ function validate_label($label, $pdo) {
|
||||||
if (strlen($label) < 2) {
|
if (strlen($label) < 2) {
|
||||||
return 'Total length of your domain must be greater then 2 characters';
|
return 'Total length of your domain must be greater then 2 characters';
|
||||||
}
|
}
|
||||||
|
if (strpos($label, '.') === false) {
|
||||||
|
return 'Invalid domain name format, must contain at least one dot (.)';
|
||||||
|
}
|
||||||
if (strpos($label, 'xn--') === false && preg_match("/(^-|^\.|-\.|\.-|--|\.\.|-$|\.$)/", $label)) {
|
if (strpos($label, 'xn--') === false && preg_match("/(^-|^\.|-\.|\.-|--|\.\.|-$|\.$)/", $label)) {
|
||||||
return 'Invalid domain name format, cannot begin or end with a hyphen (-)';
|
return 'Invalid domain name format, cannot begin or end with a hyphen (-)';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue