Better dummy newdev MAC check

This commit is contained in:
jokob-sk
2025-02-08 08:17:37 +11:00
parent b921144dbb
commit 2a5e419034
2 changed files with 8 additions and 3 deletions

View File

@@ -348,9 +348,10 @@
const createNew = mac === 'new' ? 1 : 0; const createNew = mac === 'new' ? 1 : 0;
const devLastIP = $('#NEWDEV_devLastIP').val(); const devLastIP = $('#NEWDEV_devLastIP').val();
const newMac = $('#NEWDEV_devMac').val()
// Validate MAC and Last IP // Validate MAC and Last IP
if (mac === '' || !(isValidIPv4(devLastIP) || isValidIPv6(devLastIP))) { if (mac === '' || !isValidMac(newMac) || !( isValidIPv4(devLastIP) || isValidIPv6(devLastIP) )) {
showMessage(getString("DeviceEdit_ValidMacIp"), 5000, "modal_red"); showMessage(getString("DeviceEdit_ValidMacIp"), 5000, "modal_red");
return; return;
} }
@@ -403,7 +404,6 @@
// Everything loaded // Everything loaded
hideSpinner(); hideSpinner();
}); });
} }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------

View File

@@ -776,6 +776,11 @@ function checkMacOrInternet(inputStr) {
} }
} }
// Alias
function isValidMac(value) {
return checkMacOrInternet(value);
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Gte MAC from query string // Gte MAC from query string
function getMac(){ function getMac(){