libs/web: allow one-character hostnames
[project/luci.git] / libs / web / htdocs / luci-static / resources / cbi.js
index 5eee59c..123e8e1 100644 (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;
        },