luci-0.11: merge r9351
authorJo-Philipp Wich <jow@openwrt.org>
Sat, 6 Oct 2012 23:50:52 +0000 (23:50 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sat, 6 Oct 2012 23:50:52 +0000 (23:50 +0000)
libs/web/htdocs/luci-static/resources/cbi.js
libs/web/luasrc/cbi/datatypes.lua

index b07215c..d8719c4 100644 (file)
@@ -148,8 +148,8 @@ var cbi_validators = {
        'hostname': function()
        {
                if (this.length <= 253)
-                       return (this.match(/^[a-zA-Z]+$/) != null ||
-                               (this.match(/^[a-zA-Z0-9][a-zA-Z0-9\-.]*[a-zA-Z0-9]$/) &&
+                       return (this.match(/^[a-zA-Z0-9]+$/) != null ||
+                               (this.match(/^[a-zA-Z0-9_][a-zA-Z0-9_\-.]*[a-zA-Z0-9]$/) &&
                                 this.match(/[^0-9.]/)));
 
                return false;
index 4858619..32530c4 100644 (file)
@@ -179,8 +179,8 @@ end
 
 function hostname(val)
        if val and (#val < 254) and (
-          val:match("^[a-zA-Z]+$") or
-          (val:match("^[a-zA-Z0-9][a-zA-Z0-9%-%.]*[a-zA-Z0-9]$") and
+          val:match("^[a-zA-Z_]+$") or
+          (val:match("^[a-zA-Z0-9_][a-zA-Z0-9_%-%.]*[a-zA-Z0-9]$") and
            val:match("[^0-9%.]"))
        ) then
                return true