Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions photon-client/src/components/settings/NetworkingCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ const isValidNetworkTablesIP = (v: string | undefined): boolean => {
return isValidHostname(v);
};
const isValidIPv4 = (v: string | undefined) => {
// https://stackoverflow.com/a/17871737
const ipv4Regex = /^((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])$/;
// https://stackoverflow.com/a/17871737 - modified to only allow between 10-19
// regexr.com/8beu1
const ipv4Regex = /^((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}0?(1[0-9]|10)$/;

if (v === undefined) return false;
return ipv4Regex.test(v);
Expand Down Expand Up @@ -183,7 +184,9 @@ watchEffect(() => {
v-model="tempSettingsStruct.staticIp"
:input-cols="12 - 4"
label="Static IP"
:rules="[(v) => isValidIPv4(v) || 'Invalid IPv4 address']"
:rules="[
(v) => isValidIPv4(v) || 'Invalid IPv4 address - make sure that the last digit is between 10 and 19?'
]"
:disabled="
!tempSettingsStruct.shouldManage ||
!useSettingsStore().network.canManage ||
Expand Down
Loading