diff options
| author | winter Sparkles | 2026-08-09 16:22:51 +0100 |
|---|---|---|
| committer | winter Sparkles | 2026-08-09 16:22:51 +0100 |
| commit | cf123326b13e2f648b0a1cca4d8d1c7264e2e5d8 (patch) | |
| tree | 5390d3446f3a237d46d8249fd86946d869476551 /routes | |
| parent | b0d91b0db3576a2dc7b4ebac518724d8063c5de1 (diff) | |
put 'next' redirects also in logout page
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/logout.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/routes/logout.php b/routes/logout.php index 14fcedb..0729061 100644 --- a/routes/logout.php +++ b/routes/logout.php @@ -1,10 +1,17 @@ <?php -function GET() { +function nextTarget(array $config) { + if (isset($_GET['next']) && Psso\isValidRedirect($_GET['next'], $config)) { + return $_GET['next']; + } + return '/'; +} + +function GET(array $config) { $session = Psso\Session::get(); if ($session->getIdentity() === null) { // not actually logged in anyway - header('Location: /'); + header('Location: ' . nextTarget($config)); return; } @@ -18,8 +25,8 @@ function GET() { $resp->send(); } -function POST() { +function POST(array $config) { $session = Psso\Session::get(); $session->setIdentity(null); - header('Location: /'); + header('Location: ' . nextTarget($config)); } |
