diff options
| author | winter Sparkles | 2026-08-09 18:48:59 +0100 |
|---|---|---|
| committer | winter Sparkles | 2026-08-09 18:48:59 +0100 |
| commit | f04f2e4b9aaee519a7549e58f3f9826281c90093 (patch) | |
| tree | 6c66f6dac58aeb354da3d229dbc23d9fb35548c3 | |
| parent | f1019ef47772cecb29701332b64005a0f2031a24 (diff) | |
| -rw-r--r-- | locale/en.ini | 3 | ||||
| -rw-r--r-- | routes/index.php | 14 |
2 files changed, 13 insertions, 4 deletions
diff --git a/locale/en.ini b/locale/en.ini index cb1766d..e1c13f9 100644 --- a/locale/en.ini +++ b/locale/en.ini @@ -4,6 +4,9 @@ error.not-found.long = "The page you requested (%s) does not exist." error.wrong-method = "Invalid method" error.wrong-method.long = "Your request method (%s) is not valid for this path." error.uncaught = "Uncaught exception" +home.welcome = "Welcome to %s." +home.logged-in = "You are currently logged in as %s." +home.logged-out = "You are currently logged out." ui.powered-by = "Powered by Pleasant SSO" ui.source-code = "Source code" logout.title = "Log out" diff --git a/routes/index.php b/routes/index.php index f884be5..a76e285 100644 --- a/routes/index.php +++ b/routes/index.php @@ -1,20 +1,26 @@ <?php -function GET() { +function GET(array $config) { $session = Psso\Session::get(); - // all of this markup is temporary and for testing only :3 $resp = new Psso\XMLResponse; $content = $resp->doc->addChild('content'); - $content->addChild('p', 'Welcome to Pleasant SSO!'); + + $content->addChild('p', L('home.welcome', $config['site']['name'])); + $identity = $session->getIdentity(); - $content->addChild('pre', 'Your identity: ' . print_r($identity, true)); if ($identity === null) { + $content->addChild('p', L('home.logged-out')); $link = $content->addChild('a', L('login.title')); $link->addAttribute('href', '/login'); } else { + $name = isset($identity->extras['name']) ? + $identity->extras['name'] . " ($identity->user)" : + $identity->user; + $content->addChild('p', L('home.logged-in', $name)); $link = $content->addChild('a', L('logout.title')); $link->addAttribute('href', '/logout'); } + $resp->send(); } |
