aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwinter Sparkles2026-08-09 16:22:51 +0100
committerwinter Sparkles2026-08-09 16:22:51 +0100
commitcf123326b13e2f648b0a1cca4d8d1c7264e2e5d8 (patch)
tree5390d3446f3a237d46d8249fd86946d869476551
parentb0d91b0db3576a2dc7b4ebac518724d8063c5de1 (diff)
put 'next' redirects also in logout page
-rw-r--r--routes/logout.php15
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));
}