From 33db4f2842474f780d30a393380df38742f41759 Mon Sep 17 00:00:00 2001 From: Andres Rey Date: Tue, 10 Oct 2017 10:40:18 +0100 Subject: [PATCH] Redirect the user in a POST-Redirect-GET fashion after a successful login --- scripts/pi-hole/php/password.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/pi-hole/php/password.php b/scripts/pi-hole/php/password.php index 40095563..acb404ab 100644 --- a/scripts/pi-hole/php/password.php +++ b/scripts/pi-hole/php/password.php @@ -40,6 +40,13 @@ if($postinput == $pwhash) { $_SESSION["hash"] = $pwhash; + + // Login successful, redirect the user to the homepage to discard the POST request + if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_SERVER['QUERY_STRING'] === 'login') { + header(sprintf('Location: index.php')); + exit(); + } + $auth = true; } else