aboutsummaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/index.php14
1 files changed, 10 insertions, 4 deletions
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();
}