From e7589945a28f1c741a82423b7683b42d1c8b27ca Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sat, 7 Oct 2017 16:41:30 -0400 Subject: [PATCH 1/5] Disable password field if no password is set For someone to actually whitelist a domain without a password, more changes will be needed on the PHP side. --- advanced/index.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/advanced/index.php b/advanced/index.php index 911f3cc8..1fa6a53c 100644 --- a/advanced/index.php +++ b/advanced/index.php @@ -209,11 +209,17 @@ if (explode("-", $phVersion)[1] != "0") window.onload = function () { 0) echo '$("#bpBack").removeAttr("href");'; - // Enable whitelisting if $svPasswd is present & JS is available - if (!empty($svPasswd) && $featuredTotal > 0) { - echo '$("#bpWLPassword, #bpWhitelist").prop("disabled", false);'; + if ($featuredTotal > 0) { + echo '$("#bpBack").removeAttr("href");'; + + // Enable whitelisting if JS is available + echo '$("#bpWhitelist").prop("disabled", false);'; + + // Enable password input if necessary + if (!empty($svPasswd)) { echo '$("#bpWLPassword").attr("placeholder", "Password");'; + echo '$("#bpWLPassword").prop("disabled", false);'; + } } ?> } From 009fa2f1b7f44ce983eece60a19ec1c109dcdcfe Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Wed, 1 Nov 2017 21:30:14 -0400 Subject: [PATCH 2/5] Hide password textbox if there is no password --- advanced/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/advanced/index.php b/advanced/index.php index 1fa6a53c..923aa7ce 100644 --- a/advanced/index.php +++ b/advanced/index.php @@ -218,6 +218,7 @@ if (explode("-", $phVersion)[1] != "0") // Enable password input if necessary if (!empty($svPasswd)) { echo '$("#bpWLPassword").attr("placeholder", "Password");'; + echo '$("#bpWLPassword").css("display", "inline-block");'; echo '$("#bpWLPassword").prop("disabled", false);'; } } @@ -273,7 +274,7 @@ if (explode("-", $phVersion)[1] != "0")
- +
From 1a5c86d32e1bd3b9214ed2845b4a3488682f7d62 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Tue, 23 Jan 2018 20:28:43 -0500 Subject: [PATCH 3/5] Revert "Hide password textbox if there is no password" This reverts commit 009fa2f1b7f44ce983eece60a19ec1c109dcdcfe. --- advanced/index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/advanced/index.php b/advanced/index.php index d3e2f768..45d9882a 100644 --- a/advanced/index.php +++ b/advanced/index.php @@ -245,7 +245,6 @@ setHeader(); // Enable password input if necessary if (!empty($svPasswd)) { echo '$("#bpWLPassword").attr("placeholder", "Password");'; - echo '$("#bpWLPassword").css("display", "inline-block");'; echo '$("#bpWLPassword").prop("disabled", false);'; } } @@ -301,7 +300,7 @@ setHeader();
- +
From 2cf1f0e8fc96e346ccde2a643f263af0fc50f6dc Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sun, 11 Feb 2018 14:07:02 -0500 Subject: [PATCH 4/5] Hide the password input when there is no password Signed-off-by: Mcat12 --- advanced/index.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/advanced/index.php b/advanced/index.php index 45d9882a..4328714a 100644 --- a/advanced/index.php +++ b/advanced/index.php @@ -99,7 +99,7 @@ if ($serverName === "pi.hole") { /* Start processing Block Page from here */ // Determine placeholder text based off $svPasswd presence -$wlPlaceHolder = empty($svPasswd) ? "No admin password set" : "Javascript disabled"; +$wlPlaceHolder = empty($svPasswd) ? "" : "Javascript disabled"; // Define admin email address text based off $svEmail presence $bpAskAdmin = !empty($svEmail) ? '' : ""; @@ -247,6 +247,10 @@ setHeader(); echo '$("#bpWLPassword").attr("placeholder", "Password");'; echo '$("#bpWLPassword").prop("disabled", false);'; } + // Otherwise hide the input + else { + echo '$("#bpWLPassword").hide();'; + } } ?> } From 8a42ef431b86bd1a0bac8155e85c6e75899f6833 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sun, 11 Feb 2018 21:49:12 -0500 Subject: [PATCH 5/5] Fix Javascript warning when no password is set Signed-off-by: Mcat12 --- advanced/index.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/advanced/index.php b/advanced/index.php index 4328714a..14da9ecf 100644 --- a/advanced/index.php +++ b/advanced/index.php @@ -98,9 +98,6 @@ if ($serverName === "pi.hole") { /* Start processing Block Page from here */ -// Determine placeholder text based off $svPasswd presence -$wlPlaceHolder = empty($svPasswd) ? "" : "Javascript disabled"; - // Define admin email address text based off $svEmail presence $bpAskAdmin = !empty($svEmail) ? '' : ""; @@ -304,7 +301,7 @@ setHeader();
- +