luci-base: allow terminal '.' in hostname checks

allowed in hostnames to represent the root of the DNS hierarchy

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This commit is contained in:
Paul Donald 2024-10-22 22:33:00 +02:00
parent 361bee37af
commit 1f32729428

View File

@ -394,7 +394,7 @@ var ValidatorFactory = baseclass.extend({
if (this.value.length <= 253)
return this.assert(
(this.value.match(/^[a-zA-Z0-9_]+$/) != null ||
(this.value.match(/^[a-zA-Z0-9_][a-zA-Z0-9_\-.]*[a-zA-Z0-9]$/) &&
(this.value.match(/^[a-zA-Z0-9_][a-zA-Z0-9_\-.]*[a-zA-Z0-9]\.?$/) &&
this.value.match(/[^0-9.]/))) &&
(!strict || !this.value.match(/^_/)),
_('valid hostname'));