diff options
Diffstat (limited to 'routes/logout.php')
| -rw-r--r-- | routes/logout.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/routes/logout.php b/routes/logout.php new file mode 100644 index 0000000..21b2179 --- /dev/null +++ b/routes/logout.php @@ -0,0 +1,24 @@ +<?php + +function GET() { + $session = Psso\Session::get(); + if ($session->getIdentity() === null) { + // not actually logged in anyway + header('Location: /'); + return; + } + + $resp = new Psso\XMLResponse; + $resp->doc->addAttribute('title', L('logout.title')); + $form = $resp->doc->addChild('form'); + $form->addChild('p', L('logout.warning')); + $form->addAttribute('method', 'post'); + $form->addChild('button', L('logout.confirm')); + $resp->send(); +} + +function POST() { + $session = Psso\Session::get(); + $session->setIdentity(null); + header('Location: /'); +} |
