Skip to content

Commit

Permalink
fix: Fix validating gateway in adding public IP on farm: (#2933)
Browse files Browse the repository at this point in the history
- Returned back validation that was removed by mistake.
  • Loading branch information
Mahmoud-Emad authored Jun 9, 2024
1 parent bb895df commit 9d671ca
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/playground/src/dashboard/components/add_ip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@

<script lang="ts">
import { TFChainErrors } from "@threefold/types";
import { contains } from "cidr-tools";
import { getIPRange } from "get-ip-range";
import { default as PrivateIp } from "private-ip";
import { ref, watch } from "vue";
Expand Down Expand Up @@ -207,6 +208,12 @@ export default {
const firstIP = publicIP?.value.split("/")[0];
const lastIP = toPublicIP?.value.split("/")[0];
if (!contains(publicIP.value, gateway.value)) {
return {
message: "Gateway IP not in the provided IP range.",
};
}
if (firstIP === gateway.value || lastIP === gateway.value) {
return {
message: "IPs cannot be the same.",
Expand Down

0 comments on commit 9d671ca

Please sign in to comment.