Excluded colon from domain field validation

This commit is contained in:
prij 2017-09-12 07:20:42 +12:00 committed by Will Rossiter
parent 784c3fca5e
commit 32385e580d
2 changed files with 6 additions and 3 deletions

View File

@ -36,7 +36,7 @@ class WildcardDomainField extends TextField
*/ */
public function checkHostname($hostname) public function checkHostname($hostname)
{ {
return (bool)preg_match('/^([a-z0-9\*]+[\-\.])*([a-z0-9\*]+)$/', $hostname); return (bool)preg_match('/^([a-z0-9\*]+[\-\.\:])*([a-z0-9\*]+)$/', $hostname);
} }
public function Type() public function Type()

View File

@ -54,7 +54,9 @@ class WildcardDomainFieldTest extends SapphireTest
['domain7'], ['domain7'],
['mysite.co.n-z'], ['mysite.co.n-z'],
['subdomain.my-site.com'], ['subdomain.my-site.com'],
['subdomain.mysite'] ['subdomain.mysite'],
['subdomain.mysite.com:80'],
['mysite:80']
]; ];
} }
@ -70,7 +72,8 @@ class WildcardDomainFieldTest extends SapphireTest
['.mysite.*'], ['.mysite.*'],
['mys..ite.*'], ['mys..ite.*'],
['*.mysite-'], ['*.mysite-'],
['*.mysite.'] ['*.mysite.'],
[':1234']
]; ];
} }