From b8d43db5ec2da839b6510034b021ef8736c8d281 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Tue, 17 Sep 2024 13:44:47 +0200 Subject: [PATCH] small fixes only --- functions.js | 16 ++++++++++++---- index.php | 20 ++++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/functions.js b/functions.js index cbd1b98..a35cd5c 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 0ec9133..f02874c 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 -- GitLab