增加区域IP验证处理:由于接口源IP目的IP不能相同,且区域IP只能输入源IP.所以对于IP默认值加入了限制。
This commit is contained in:
@@ -144,7 +144,7 @@ $(function(){
|
||||
<div class="col-md-6">
|
||||
|
||||
<select id="_areaCfg.ipType" class="show-tick form-control required">
|
||||
<c:forEach items="${fns:getDictList('IP_TYPE')}" var="ipTypeC">
|
||||
<c:forEach items="${fns:getDictList('AREA_IPTYPE')}" var="ipTypeC">
|
||||
<option value="${ipTypeC.itemCode}" <c:if test="${_areaCfg.ipType==ipTypeC.itemCode || (_areaCfg.ipType==null && ipTypeC.itemCode==4)}">selected</c:if>><spring:message code="${ipTypeC.itemValue}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
@@ -171,7 +171,7 @@ $(function(){
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_ip"/></label>
|
||||
<div class="col-md-6">
|
||||
<input id="_areaCfg.srcIpAddress" class="form-control required ipCheck" type="text" value="${_areaCfg.srcIpAddress}">
|
||||
<input id="_areaCfg.srcIpAddress" class="form-control required ipCheck areaIp" type="text" value="${_areaCfg.srcIpAddress}">
|
||||
</div>
|
||||
<div for="_areaCfg.srcIpAddress"></div>
|
||||
</div>
|
||||
@@ -295,7 +295,7 @@ $(function(){
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_ip"/></label>
|
||||
<div class="col-md-6">
|
||||
<input name="areaCfg[${status.index}].srcIpAddress" class="form-control required ipCheck" type="text" value="${areaCfg.srcIpAddress}">
|
||||
<input name="areaCfg[${status.index}].srcIpAddress" class="form-control required ipCheck areaIp" type="text" value="${areaCfg.srcIpAddress}">
|
||||
</div>
|
||||
<div for="areaCfg[${status.index}].srcIpAddress"></div>
|
||||
</div>
|
||||
|
||||
@@ -323,6 +323,58 @@ jQuery.validator.addMethod("areaControl",function(value, element) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
jQuery.validator.addMethod("areaIp",function(value, element) {
|
||||
var typeInt=$(element).parents(".row").parent(".row").find("select[name$='ipType']").val();
|
||||
var ipPattern=$(element).parents(".row").parent(".row").find("select[name$='ipPattern']").val();
|
||||
var msg=$.validator.messages.areaIpPrefix;
|
||||
if(typeInt==4){
|
||||
if(ipPattern==3){
|
||||
if(value=='0.0.0.0'){
|
||||
$.validator.messages.areaIp=msg+'0.0.0.0';
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}else if(ipPattern==2){
|
||||
if(value=='0.0.0.0-1.1.1.1'){
|
||||
$.validator.messages.areaIp=msg+'0.0.0.0-1.1.1.1';
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}else if(ipPattern==1){
|
||||
if(value=='0.0.0.0/8'){
|
||||
$.validator.messages.areaIp=msg+'0.0.0.0/8';
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}else if(typeInt==6){
|
||||
if(ipPattern==3){
|
||||
if(value=='::'){
|
||||
$.validator.messages.areaIp=msg+'::';
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}else if(ipPattern==2){
|
||||
if(value=='::-::'){
|
||||
$.validator.messages.areaIp=msg+'::-::';
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}else if(ipPattern==1){
|
||||
if(value=='::/64'){
|
||||
$.validator.messages.areaIp=msg+'::/64';
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//ip v4转数字
|
||||
var ipToNumber=function (ip){
|
||||
var num =0;
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
all: "all",
|
||||
ip_subnet: "Subnet",
|
||||
ip_range: "ip Range",
|
||||
timeout:"timeout"
|
||||
timeout:"timeout",
|
||||
areaIpPrefix:"Forbiden value: "
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
all: "all",
|
||||
ip_subnet: "Subnet",
|
||||
ip_range: "ip Range",
|
||||
timeout:"timeout"
|
||||
timeout:"timeout",
|
||||
areaIpPrefix:"Forbiden value: "
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -50,6 +50,7 @@
|
||||
ip_subnet: "Subnet",
|
||||
ip_subnet: "Subnet",
|
||||
ip_range: "ip Range",
|
||||
timeout:"超时"
|
||||
timeout:"超时",
|
||||
areaIpPrefix:"禁止使用的值: "
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
Reference in New Issue
Block a user