Keep 4.x login CSRF token stable across repeated GETs (#1087)

Do not recreate the CSRF token in the session if one already exists, this should avoid people seeing an expired CSRF token error
thanks @TrapoSAMA
This commit is contained in:
Rodrigo Cortés Cano authored and GitHub committed 2026-07-22 08:55:32 +01:00
1 parent bfe0b8cfd0
commit 26c56cf0e8
1 file changed
+4 -1
+4 -1
View File
@@ -109,7 +109,10 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
session_start();
}
$_SESSION['PFA_token'] = md5(uniqid("pfa" . rand(), true));
if (empty($_SESSION['PFA_token'])) {
// Keep the login token stable across repeated GETs in this session.
$_SESSION['PFA_token'] = md5(uniqid("pfa" . rand(), true));
}
$smarty->assign('language_selector', language_selector(), false);
$smarty->assign('smarty_template', 'login');