mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Better dummy newdev MAC check
This commit is contained in:
@@ -348,16 +348,17 @@
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
showSpinner();
|
showSpinner();
|
||||||
|
|
||||||
// Update data to server using POST
|
// Update data to server using POST
|
||||||
$.post('php/server/devices.php?action=setDeviceData', {
|
$.post('php/server/devices.php?action=setDeviceData', {
|
||||||
mac: $('#NEWDEV_devMac').val(),
|
mac: $('#NEWDEV_devMac').val(),
|
||||||
name: encodeURIComponent($('#NEWDEV_devName').val().replace(/'/g, "")),
|
name: encodeURIComponent($('#NEWDEV_devName').val().replace(/'/g, "")),
|
||||||
@@ -403,7 +404,6 @@
|
|||||||
// Everything loaded
|
// Everything loaded
|
||||||
hideSpinner();
|
hideSpinner();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -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(){
|
||||||
|
|||||||
Reference in New Issue
Block a user