Validate domain names #48

Merged
lpoujol merged 5 commits from features/validate-domains into master 2019-03-20 16:40:09 +01:00
Showing only changes of commit 501f6ebbab - Show all commits

View file

@ -426,7 +426,7 @@ class DomainInputFormField extends FormField {
return FALSE;
}
if (!preg_match("/^[a-z0-9-.]+\.[a-z]{2,}$/i", $this->value)) {
if (!preg_match("/^[a-z0-9-.]+\.[a-z0-9-]{2,}$/i", $this->value)) {
if($set_error) $this->error = 'Ceci n\'est pas un nom de domaine';
return FALSE;
}
@ -476,7 +476,7 @@ class DomainListInputFormField extends FormField {
if(strlen($this->value)){
$list = explode(',', $this->value);
foreach ($list as $value) {
if (!preg_match("/^[a-z0-9-.]+\.[a-z]{2,}$/i", $value)) {
if (!preg_match("/^[a-z0-9-.]+\.[a-z0-9-]{2,}$/i", $value)) {
if($set_error) $this->error = 'Ceci n\'est pas un nom de domaine';
return FALSE;
}