From eb9183edcba7e7eb30f9f2c2176760bd4024555f Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Sun, 26 Mar 2023 10:17:59 +0100 Subject: [PATCH] Add plugin to debug login cookie issues --- login-debug.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 login-debug.php diff --git a/login-debug.php b/login-debug.php new file mode 100644 index 0000000..dd782ff --- /dev/null +++ b/login-debug.php @@ -0,0 +1,40 @@ +<?php +/* +* Plugin Name: A/I - Debug login issues +* Plugin URI: +* Description: Debug login issues +* Version: 0.0.1 +* Author: Autistici/Inventati +* Author URI: https://autistici.org +**/ + +function debug_login_auth_cookie_malformed($cookie, $scheme) { + error_log("LOGIN: auth_cookie_malformed: scheme={$scheme} cookie={$cookie}"); +} +add_action('auth_cookie_malformed', 'debug_login_auth_cookie_malformed', 10, 2); + +function debug_login_auth_cookie_expired($cookie_elements) { + $username = $cookie_elements['username']; + error_log("LOGIN: auth_cookie_expired: username={$username}"); +} +add_action('auth_cookie_expired', 'debug_login_auth_cookie_expired'); + +function debug_login_auth_cookie_bad_username($cookie_elements) { + $username = $cookie_elements['username']; + error_log("LOGIN: auth_cookie_bad_username: username={$username}"); +} +add_action('auth_cookie_bad_username', 'debug_login_auth_cookie_bad_username'); + +function debug_login_auth_cookie_bad_hash($cookie_elements) { + $username = $cookie_elements['username']; + $token = $cookie_elements['token']; + error_log("LOGIN: auth_cookie_bad_hash: username={$username} token={$token}"); +} +add_action('auth_cookie_bad_hash', 'debug_login_auth_cookie_bad_hash'); + +function debug_login_auth_cookie_bad_session_token($cookie_elements) { + $username = $cookie_elements['username']; + $token = $cookie_elements['token']; + error_log("LOGIN: auth_cookie_bad_session_token: username={$username} token={$token}"); +} +add_action('auth_cookie_bad_session_token', 'debug_login_auth_cookie_bad_session_token'); -- GitLab