mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-7765: Field Validations Missing for VPC IP Address Fields
This commit is contained in:
parent
a265d7b505
commit
1033990e91
|
|
@ -5340,12 +5340,16 @@
|
|||
label: 'label.super.cidr.for.guest.networks',
|
||||
docID: 'helpVPCSuperCIDR',
|
||||
validation: {
|
||||
required: true
|
||||
required: true,
|
||||
ipv4cidr: true
|
||||
}
|
||||
},
|
||||
networkdomain: {
|
||||
docID: 'helpVPCDomain',
|
||||
label: 'label.DNS.domain.for.guest.networks'
|
||||
label: 'label.DNS.domain.for.guest.networks',
|
||||
validation: {
|
||||
ipv4: true
|
||||
}
|
||||
},
|
||||
publicLoadBalancerProvider: {
|
||||
label: 'label.public.load.balancer.provider',
|
||||
|
|
|
|||
|
|
@ -2293,3 +2293,24 @@ $.validator.addMethod("ipv6cidr", function(value, element) {
|
|||
return true;
|
||||
}, "The specified IPv6 CIDR is invalid.");
|
||||
|
||||
$.validator.addMethod("ipv4cidr", function(value, element) {
|
||||
if (this.optional(element) && value.length == 0)
|
||||
return true;
|
||||
|
||||
var parts = value.split('/');
|
||||
if (typeof parts == 'undefined' || parts.length != 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$.validator.methods.ipv4.call(this, parts[0], element))
|
||||
return false;
|
||||
|
||||
if (parts[1] != Number(parts[1]).toString()) //making sure that "", " ", "00", "0 ","2 ", etc. will not pass
|
||||
return false;
|
||||
|
||||
if (Number(parts[1]) < 0 || Number(parts[1] > 32))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}, "The specified IPv4 CIDR is invalid.");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue