Skip to content

Commit

Permalink
goodbye cidrs
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-nettica committed Jun 25, 2024
1 parent be416a5 commit 5df1bee
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 37 deletions.
24 changes: 12 additions & 12 deletions ui/src/components/Devices.vue
Original file line number Diff line number Diff line change
Expand Up @@ -984,19 +984,19 @@ export default {
}
// check allowed IPs
for (let i = 0; i < this.vpn.current.allowedIPs.length; i++) {
if (this.$isCidr(this.vpn.current.allowedIPs[i]) === 0) {
this.errorDevice('Invalid CIDR detected, please correct before submitting');
return
}
}
// for (let i = 0; i < this.vpn.current.allowedIPs.length; i++) {
// if (this.$isCidr(this.vpn.current.allowedIPs[i]) === 0) {
// this.errorDevice('Invalid CIDR detected, please correct before submitting');
// return
// }
// }
// check address
for (let i = 0; i < this.vpn.current.address.length; i++) {
if (this.$isCidr(this.vpn.current.address[i]) === 0) {
this.errorDevice('Invalid CIDR detected, please correct before submitting');
return
}
}
//for (let i = 0; i < this.vpn.current.address.length; i++) {
// if (this.$isCidr(this.vpn.current.address[i]) === 0) {
// this.errorDevice('Invalid CIDR detected, please correct before submitting');
// return
// }
//}
vpn = this.vpn
this.inEdit = false;
this.updatevpn(this.vpn)
Expand Down
38 changes: 13 additions & 25 deletions ui/src/components/Network.vue
Original file line number Diff line number Diff line change
Expand Up @@ -903,12 +903,12 @@ export default {
this.errorNet('Please provide at least one valid CIDR address for net allowed IPs')
return;
}
for (let i = 0; i < net.default.allowedIPs.length; i++) {
if (this.$isCidr(net.default.allowedIPs[i]) === 0) {
this.errorNet('Invalid CIDR detected, please correct before submitting')
return
}
}
//for (let i = 0; i < net.default.allowedIPs.length; i++) {
// if (this.$isCidr(net.default.allowedIPs[i]) === 0) {
// this.errorNet('Invalid CIDR detected, please correct before submitting')
// return
// }
//}
this.net.accountid = this.acntList.selected.value
this.dialogCreate = false;
this.createNet(net)
Expand Down Expand Up @@ -1083,29 +1083,17 @@ export default {
this.net.id = net.id
this.net.netName = net.netName


// check allowed IPs
if (net.default.allowedIPs.length < 1) {
this.errorNet('Please provide at least one valid CIDR address for net allowed IPs');
return;
}
for (let i = 0; i < net.default.allowedIPs.length; i++) {
if (this.$isCidr(net.default.allowedIPs[i]) === 0) {
this.errorNet('Invalid CIDR detected, please correct before submitting');
return
}
}
// check address
if (net.default.address.length < 1) {
this.errorNet('Please provide at least one valid CIDR address for net');
return;
}
for (let i = 0; i < net.default.address.length; i++) {
if (this.$isCidr(net.default.address[i]) === 0) {
this.errorNet('Invalid CIDR detected, please correct before submitting');
return
}
}

// check allowed IPs
if (net.default.allowedIPs.length < 1) {
this.net.default.allowedIPs = this.net.default.address;
}
// all good, submit
this.dialogUpdate = false;
this.updateNet(net)
Expand All @@ -1132,7 +1120,7 @@ export default {
}

// check allowed IPs
for (let i = 0; i < this.vpn.current.allowedIPs.length; i++) {
/* for (let i = 0; i < this.vpn.current.allowedIPs.length; i++) {
if (this.$isCidr(this.vpn.current.allowedIPs[i]) === 0) {
this.errorNet('Invalid CIDR detected, please correct before submitting');
return
Expand All @@ -1144,7 +1132,7 @@ export default {
this.errorNet('Invalid CIDR detected, please correct before submitting');
return
}
}
}*/

this.inEdit = false;
this.updatevpn(this.vpn)
Expand Down

0 comments on commit 5df1bee

Please sign in to comment.