diff --git a/functions.js b/functions.js index cbd1b98878214f3891f86d4d72ba3873f1bb48dd..a35cd5ccb3bd419e58bd8cb94b12ac8858057646 100644 --- a/functions.js +++ b/functions.js @@ -141,7 +141,7 @@ function showError($sMessage){ } /** - * Check if user is logged in in shibboleth + * Check if user is logged in in Shibboleth. * It shows an error, ib shibboleth is not available. * It detects if a user is logged in. */ @@ -179,8 +179,13 @@ async function checkSession() { } } +// ---------------------------------------------------------------------- +// INIT +// ---------------------------------------------------------------------- - +/** + * Init step 1: load language file and make it available in aLang + */ async function init(){ fetch('lang/' + sLang + '.json') .then(response => response.json()) @@ -192,15 +197,18 @@ async function init(){ } +/** + * Init step 2: Check Shibboleth session + */ async function initStep2(langArray) { aLang = langArray; checkSession(); } -// ---------------------------------------------------------------------- -// INIT + // ---------------------------------------------------------------------- +// MAIN init(); // ---------------------------------------------------------------------- diff --git a/index.php b/index.php index 0ec913347cd8a6a488d22df00b80e321cc2117ab..f02874cbf6d5ce3e14fa67f1fa9763c43774de24 100644 --- a/index.php +++ b/index.php @@ -16,6 +16,14 @@ require 'inc_functions.php'; + $aAbout = [ + 'title' => 'AAI Login', + 'author' => 'Axel Hahn, Institute for Medical Education, University of Bern', + 'source' => 'https://git-repo.iml.unibe.ch/iml-open-source/login-aai', + 'license' => 'GNU GPL 3.0', + 'version' => '0.3', + ]; + ?><!DOCTYPE html> <html lang="" dir=""> @@ -41,17 +49,17 @@ <?php // --- set language for js script - echo '<input type="hdden" id="lang" value="'.($aConfig['lang'] ?? 'en').'">'; + echo '<input type="hidden" id="lang" value="'.($aConfig['lang'] ?? 'en').'">'; // --- messages echo $SELFURL ? '' : showMessage('error', 'SELFURL is not set. $_SERVER[\'SERVER_NAME\'] is not available.'); echo $aConfig['text-info'] ? showMessage('info', $aConfig['text-info']) : ''; - // --- id "errorbox" is used for javascript + // --- id "errorbox" is used for javascript error messages echo '<div id="errorbox" class="msg error hidden"></div>'; // --- text block if the user is logged in already - echo '<div id="shib-check-logged-in" class="hidden_"> + echo '<div id="shib-check-logged-in" class="hidden"> <h2>'.$L->t('logged-in-already-title').'</h2> <p> '.$L->t('logged-in-already-text').'<br> @@ -77,7 +85,11 @@ </div> <script type="text/javascript" defer src="functions.js"></script> - <footer><strong><?php echo $aConfig['title'] ?? 'AAI Login'; ?></strong><br>AAI Login v0.2 - <a href="https://git-repo.iml.unibe.ch/iml-open-source/login-aai">Source</a></a></footer> + <footer> + <strong><?php echo $aConfig['title'] ?? 'AAI Login'; ?></strong><br> + <?php echo $aAbout['title'].' v' .$aAbout['version']; ?> - + <a href="<?php echo $aAbout['source']; ?>">Source</a> + </footer> </body> </html> \ No newline at end of file