Add simple login button & indicator to navbar

This commit is contained in:
2017-10-28 17:19:40 +02:00
parent 7e3d256f93
commit 446d966e80
10 changed files with 159 additions and 11 deletions

View File

@@ -4,6 +4,9 @@ date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO');
require __DIR__ . '/../../src/_autoload.php';
require __DIR__ . '/../../sql_config.php';
require_once(__DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
$as = new SimpleSAML_Auth_Simple('default-sp');
$attrs = $as->getAttributes();
?>
<html lang="no">
<title>Kommunikasjonsverkstedet</title>
@@ -36,7 +39,8 @@ Det er også mulig å ta i bruk analog kontakt ved å møte opp <a href="https:/
</main>
<nav><ul>
<nav>
<ul>
<li><a href="../">hjem</a></li>
<!--<li><a href="../prosjekt/">prosjekter</a></li>-->
<li><a href="../kalender/">kalender</a></li>
@@ -44,4 +48,15 @@ Det er også mulig å ta i bruk analog kontakt ved å møte opp <a href="https:/
<li><a href="../prosjekt/">prosjekter</a></li>
<li class="active"><a href="../kontakt/">kontakt</a></li>
<li><a href="../pvv/">wiki</a></li>
</ul>
<?php
$attr = $as->getAttributes();
if($attr){
$uname = $attr["uid"][0];
echo '<p class="login">logget inn som: ' . $uname . '</p>';
}else{
echo '<a class="login" href="' . $as->getLoginURL() . '">logg inn</a>';
}
?>
</nav>