Skip to content

Commit 3fa7ead

Browse files
committed
webui: backport ipv4_addr validator method from 384.xx
1 parent c312de8 commit 3fa7ead

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

release/src/router/www/validator.js

+9
Original file line numberDiff line numberDiff line change
@@ -1881,6 +1881,15 @@ var validator = {
18811881
return true;
18821882
},
18831883

1884+
ipv4_addr: function(_value) {
1885+
//ip address accept is 0.0.0.0~255.255.255.255
1886+
var ipformat = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
1887+
if((ipformat.test(_value)))
1888+
return true;
1889+
else
1890+
return false;
1891+
},
1892+
18841893
safeName: function(obj){
18851894
if (obj.value.length == 0) return true;
18861895

0 commit comments

Comments
 (0)