luci-0.10: merge r8091

This commit is contained in:
Jo-Philipp Wich 2011-12-14 15:03:35 +00:00
parent 71dd8be453
commit 41469346de
2 changed files with 8 additions and 3 deletions

View file

@ -151,8 +151,10 @@ var cbi_validators = {
},
'hostname': function(v)
{ if ( v.length <= 253 )
return (v.match(/^[a-zA-Z0-9][a-zA-Z0-9\-.]*[a-zA-Z0-9]$/) != null);
{
if (v.length <= 253)
return (v.match(/^[a-zA-Z0-9]+$/) != null ||
v.match(/^[a-zA-Z0-9][a-zA-Z0-9\-.]*[a-zA-Z0-9]$/) != null);
return false;
},

View file

@ -141,7 +141,10 @@ function macaddr(val)
end
function hostname(val)
if val and (#val < 254) and val.match(val, "^[a-zA-Z0-9][a-zA-Z0-9%-%.]*[a-zA-Z0-9]$") then
if val and (#val < 254) and (
val:match("^[a-zA-Z0-9]+$") or
val:match("^[a-zA-Z0-9][a-zA-Z0-9%-%.]*[a-zA-Z0-9]$")
) then
return true
end
return false