When session token expires, redirect instead of returning a 500 error

This commit is contained in:
billz
2025-03-26 09:51:39 -07:00
parent 0960e8bac9
commit deba5e1e74

View File

@@ -23,6 +23,8 @@ class CSRFTokenizer {
// ensure a CSRF token exists in the session
if (empty($_SESSION['csrf_token'])) {
$this->ensureCSRFSessionToken();
header("Location: " .$_SERVER['REQUEST_URI']);
exit;
}
if ($this->csrfValidateRequest()) {
@@ -40,7 +42,6 @@ class CSRFTokenizer {
{
if (empty($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
$token = $_SESSION['csrf_token'];
}
}