From e972b644be1226be1e756334c43062e7b83bdbb1 Mon Sep 17 00:00:00 2001 From: BBcan177 Date: Wed, 7 Jan 2015 13:13:15 -0500 Subject: Improve Alert Tab - Suppression Code When the user clicked "Cancel" in the second JS Prompt, it would not cancel the Suppression process. This change fixes that issue. --- config/pfblockerng/pfblockerng_alerts.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'config/pfblockerng/pfblockerng_alerts.php') diff --git a/config/pfblockerng/pfblockerng_alerts.php b/config/pfblockerng/pfblockerng_alerts.php index 1b54f8f2..541d1e03 100644 --- a/config/pfblockerng/pfblockerng_alerts.php +++ b/config/pfblockerng/pfblockerng_alerts.php @@ -143,9 +143,14 @@ if (isset($_POST['addsuppress'])) { $ip = $_POST['ip']; $table = $_POST['table']; $descr = $_POST['descr']; - if (empty($descr)) - $descr = sprintf(gettext("Entry added %s"), date('r')); $cidr = $_POST['cidr']; + + // If Description or CIDR field is empty, exit. + if (empty($descr) || empty($cidr)) { + header("Location: " . $_SERVER['PHP_SELF']); + exit; + } + if (is_ipaddr($ip)) { $savemsg1 = "Host IP address {$ip}"; @@ -730,8 +735,10 @@ function hostruleid(host,table) { var description = prompt("Please enter Suppression Description"); document.getElementById("descr").value = description; - var cidr = prompt("Please enter CIDR [ 32 or 24 CIDR only supported ]","32"); - document.getElementById("cidr").value = cidr; + if (description.value != "") { + var cidr = prompt("Please enter CIDR [ 32 or 24 CIDR only supported ]","32"); + document.getElementById("cidr").value = cidr; + } } // Auto-Resolve of Alerted Hostnames -- cgit v1.2.3