From 7a9fcc16769fba56ec9efd4558a5f4f7c3abfd9c Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 24 Aug 2018 19:00:42 +0200 Subject: [PATCH] The "Wrong Token." message is shown whenever the token is wrong or not available. This commit adds more details into this message to help user's in their own troubleshooting. Signed-off-by: DL6ER --- scripts/pi-hole/php/auth.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/php/auth.php b/scripts/pi-hole/php/auth.php index 027220c9..ff236d2b 100644 --- a/scripts/pi-hole/php/auth.php +++ b/scripts/pi-hole/php/auth.php @@ -93,8 +93,16 @@ function check_csrf($token) { session_start(); } - if(!isset($_SESSION['token']) || empty($token) || !hash_equals($_SESSION['token'], $token)) { - log_and_die("Wrong token"); + if(!isset($_SESSION['token'])) { + log_and_die("Session expired! Please re-login on the Pi-hole dashboard."); + } + + if(empty($token)) { + log_and_die("Empty token! Check if cookies are enabled on your system."); + } + + if(!hash_equals($_SESSION['token'], $token)) { + log_and_die("Wrong token! Check if cookies are enabled on your system."); } }