端口验证范围调整,0到65535

This commit is contained in:
wangxin
2018-06-06 18:02:22 +08:00
parent cc5acbc271
commit 30c4dee595
4 changed files with 8 additions and 8 deletions

View File

@@ -296,14 +296,14 @@ jQuery.validator.addMethod("portCheck",function(value, element) {
typeInt=$(element).parents(".row").parent(".row").find("select[name$='portPattern']").val();
}
if(typeInt==1){//port 0~65535
if(this.optional(element)||(/^(0|[1-9][0-9]*)$/.test(value))){
if(this.optional(element)||(/^(0|[1-9][0-9]{0,4})$/.test(value)&& RegExp.$1 <=65535)){
return true;
}else{
$.validator.messages.portCheck=$.validator.messages.portRange
return false;
}
}else if(typeInt==2){// port -mask 0~65535/0~65535
if(this.optional(element)||(/^(0|[1-9][0-9]*)\/(0|[1-9][0-9]{0,4})$/.test(value) && RegExp.$2 <=65535)){
if(this.optional(element)||(/^(0|[1-9][0-9]{0,4})\/(0|[1-9][0-9]{0,4})$/.test(value) && RegExp.$1 <=65535 && RegExp.$2 <=65535)){
return true;
}else{
$.validator.messages.portCheck=$.validator.messages.portMaskRange

View File

@@ -31,8 +31,8 @@
ipRange1:"start IP should smaller than end IP",
portCheck:"Please enter a correct port",
notStartZero:"Please enter a valid Integer",
portRange:"Please enter a valid Integer",
portMaskRange:"Port must be a valid Integer and mask must between 0 and 65535.The correct pattern is \"port/mask\".",
portRange:"Port must between 0 and 65535",
portMaskRange:"Port and mask must between 0 and 65535.The correct pattern is \"port/mask\".",
chooseAreaOrIsp:"The region and the oprater must choose one",
areaControl:"Action drop and loop do not need area control",
ip_type: "ip type",

View File

@@ -29,8 +29,8 @@
ipRange:"Wrong IP format or start IP and end IP in two subnet",
ipRange1:"start IP should smaller than end IP",
portCheck: " Пожалуйста, введите  правильный  порт.",
portRange:"Please enter a valid Integer",
portMaskRange:"Port must be a valid Integer and mask must between 0 and 65535.The correct pattern is \"port/mask\".",
portRange:"Port must between 0 and 65535",
portMaskRange:"Port and mask must between 0 and 65535.The correct pattern is \"port/mask\".",
chooseAreaOrIsp:"The region and the oprater must choose one",
areaControl:"Action drop and loop do not need area control",
ip_type: "ip type",

View File

@@ -32,8 +32,8 @@
ipMaskRange:"掩码范围0到32",
ipRange:"IP范围格式错误或者起始IP与结束IP不在同一网段",
ipRange1:"起始IP值应小于结束IP值",
portRange:"端口必须为整数非0数字不能以0开头",
portMaskRange:"端口必须为整数,掩码范围0-65535非0数字不能以0开头。格式为\"端口/掩码\"",
portRange:"端口应小于65536非0数字不能以0开头",
portMaskRange:"端口以及掩码范围0-65535非0数字不能以0开头。格式为\"端口/掩码\"",
chooseAreaOrIsp:"区域和运营商必选一个",
areaControl:"丢弃和回流动作不能区域管控",
ip_type: "ip类型",