diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-23 23:19:40 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-23 23:19:40 +0000 |
commit | 6d02d50d461356343b742a2914b85e2d6d0ba5e1 (patch) | |
tree | 20a43b30a050270879e69f6eb041aac706e8a569 /libs/web/htdocs/luci-static | |
parent | f3d0ba58e526bb52d19811848caed002ea642ad8 (diff) |
libs/web: fix IPv6 live validation
Diffstat (limited to 'libs/web/htdocs/luci-static')
-rw-r--r-- | libs/web/htdocs/luci-static/resources/cbi.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/web/htdocs/luci-static/resources/cbi.js b/libs/web/htdocs/luci-static/resources/cbi.js index 059d27a1b9..62dada464e 100644 --- a/libs/web/htdocs/luci-static/resources/cbi.js +++ b/libs/web/htdocs/luci-static/resources/cbi.js @@ -75,7 +75,7 @@ var cbi_validators = { var colons = 0; var fill = '0'; - for( var i = 0; i < addr.length; i++ ) + for( var i = 1; i < (addr.length-1); i++ ) if( addr.charAt(i) == ':' ) colons++; @@ -85,7 +85,9 @@ var cbi_validators = { for( var i = 0; i < (7 - colons); i++ ) fill += ':0'; - addr = addr.replace(/::/, ':' + fill + ':'); + if (addr.match(/^(.*?)::(.*?)$/)) + addr = (RegExp.$1 ? RegExp.$1 + ':' : '') + fill + + (RegExp.$2 ? ':' + RegExp.$2 : ''); } return (addr.match(/^(?:[a-fA-F0-9]{1,4}:){7}[a-fA-F0-9]{1,4}$/) != null); |