mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
fix: add hx-swap="none" to admin auto-save checkboxes to prevent page swap
This commit is contained in:
@@ -100,16 +100,13 @@ if ($section === 'formulaire') {
|
||||
App::flash('error', "Section inconnue.");
|
||||
}
|
||||
|
||||
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
||||
|
||||
if ($isHxRequest) {
|
||||
// Return updated CSRF tokens for all three hidden inputs on the page
|
||||
$newToken = htmlspecialchars($_SESSION['csrf_token']);
|
||||
echo '<input type="hidden" id="csrf_token_files" value="' . $newToken . '" hx-swap-oob="true">';
|
||||
echo '<input type="hidden" id="csrf_token_acces" value="' . $newToken . '" hx-swap-oob="true">';
|
||||
echo '<input type="hidden" id="csrf_token_types" value="' . $newToken . '" hx-swap-oob="true">';
|
||||
// Auto-save from contenus.php — no CSRF rotation needed (token reused until full page load).
|
||||
// Return empty 200 so hx-swap="none" is a no-op.
|
||||
http_response_code(200);
|
||||
exit;
|
||||
}
|
||||
|
||||
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
||||
header('Location: /admin/parametres.php');
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user