diff --git a/lib/phplib/Seminar_Auth.class.php b/lib/phplib/Seminar_Auth.class.php index 80f6ceaf0196ea9cc3988798399388a2474cc342..0a566d16f25dec4e66109b63652059631b701d8c 100644 --- a/lib/phplib/Seminar_Auth.class.php +++ b/lib/phplib/Seminar_Auth.class.php @@ -301,24 +301,21 @@ class Seminar_Auth throw new AccessDeniedException(); } - // if desired, switch to high contrast stylesheet and store when user logs in - if (Request::get('unset_contrast')) { - unset($_SESSION['contrast']); - PageLayout::removeStylesheet('accessibility.css'); - - } - if (Request::get('set_contrast') ) { - $_SESSION['contrast'] = true; - PageLayout::addStylesheet('accessibility.css'); + if (Request::submitted('user_config_submitted')) { + CSRFProtection::verifyUnsafeRequest(); + if (Request::submitted('unset_contrast')) { + $_SESSION['contrast'] = 0; + } + if (Request::submitted('set_contrast')) { + $_SESSION['contrast'] = 1; + } - } - // evaluate language clicks - // has to be done before seminar_open to get switching back to german (no init of i18n at all)) - if (Request::get('set_language')) { - if (array_key_exists(Request::get('set_language'), $GLOBALS['INSTALLED_LANGUAGES'])) { - $_SESSION['forced_language'] = Request::get('set_language'); - $_SESSION['_language'] = Request::get('set_language'); + foreach (array_keys($GLOBALS['INSTALLED_LANGUAGES']) as $language_key) { + if (Request::submitted('set_language_' . $language_key)) { + $_SESSION['forced_language'] = $language_key; + $_SESSION['_language'] = $language_key; + } } } diff --git a/public/index.php b/public/index.php index 2a383556db865c2de2080771dcd83d3dec0055d2..abba9015187173857f3f442fd5e69e99c459983e 100644 --- a/public/index.php +++ b/public/index.php @@ -21,45 +21,8 @@ require '../lib/bootstrap.php'; page_open(['sess' => 'Seminar_Session', 'auth' => 'Seminar_Default_Auth', 'perm' => 'Seminar_Perm', 'user' => 'Seminar_User']); -$auth->login_if(Request::get('again') && ($auth->auth['uid'] == 'nobody')); - -// if desired, switch to high contrast stylesheet and store when user logs in -if (Request::submitted('user_config_submitted')) { - CSRFProtection::verifyUnsafeRequest(); - if (Request::submitted('unset_contrast')) { - $_SESSION['contrast'] = 0; - } - if (Request::submitted('set_contrast')) { - $_SESSION['contrast'] = 1; - } - -// evaluate language clicks -// has to be done before seminar_open to get switching back to german (no init of i18n at all)) - foreach (array_keys($GLOBALS['INSTALLED_LANGUAGES']) as $language_key) { - if (Request::submitted('set_language_' . $language_key)) { - $_SESSION['forced_language'] = $language_key; - $_SESSION['_language'] = $language_key; - } - } -} -// store user-specific language preference -if ($auth->is_authenticated() && $user->id != 'nobody') { - // store last language click - if (!empty($_SESSION['forced_language'])) { - $query = "UPDATE user_info SET preferred_language = ? WHERE user_id = ?"; - $statement = DBManager::get()->prepare($query); - $statement->execute([$_SESSION['forced_language'], $user->id]); - - $_SESSION['_language'] = $_SESSION['forced_language']; - } - $_SESSION['forced_language'] = null; -} - -// -- wir sind jetzt definitiv in keinem Seminar, also... -- -closeObject(); - -include 'lib/seminar_open.php'; // initialise Stud.IP-Session $auth->login_if($user->id === 'nobody'); +include 'lib/seminar_open.php'; // initialise Stud.IP-Session // if new start page is in use, redirect there (if logged in) if ($auth->is_authenticated() && $user->id != 'nobody') { diff --git a/resources/assets/stylesheets/scss/index.scss b/resources/assets/stylesheets/scss/index.scss index e9234de30b0c9826f1df8ed34bb2d82a50daf671..7b1c0b9b9af2cd0a319efb81df4db047f3dbe378 100644 --- a/resources/assets/stylesheets/scss/index.scss +++ b/resources/assets/stylesheets/scss/index.scss @@ -108,9 +108,6 @@ $gap-between-boxes: calc($login-page-margin / 2); font-size: 0.9em; padding: 10px; - button { - text-decoration: underline; - } } #contrast { diff --git a/templates/index_nobody.php b/templates/index_nobody.php deleted file mode 100644 index ac21d9c6feee70ed5b302d96bf90583eb02020f8..0000000000000000000000000000000000000000 --- a/templates/index_nobody.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * @var bool $logout - * @var string[] $plugin_contents - */ - -// Get background images (this should be resolved differently since mobile -// browsers might still download the desktop background) -$bg_desktop = LoginBackground::getRandomPicture('desktop'); -if ($bg_desktop) { - $bg_desktop = $bg_desktop->getURL(); -} else { - $bg_desktop = URLHelper::getURL('pictures/loginbackgrounds/1.jpg'); -} -$bg_mobile = LoginBackground::getRandomPicture('mobile'); -if ($bg_mobile) { - $bg_mobile = $bg_mobile->getURL(); -} else { - $bg_mobile = URLHelper::getURL('pictures/loginbackgrounds/2.jpg'); -} -?> -<!-- Startseite (nicht eingeloggt) --> -<main id="content"> - <? if ($logout): ?> - <?= MessageBox::success( - _('Sie sind nun aus dem System abgemeldet.'), - array_filter((array) $GLOBALS['UNI_LOGOUT_ADD'])) ?> - <? endif; ?> - - <div id="background-desktop" style="background: url(<?= $bg_desktop ?>) no-repeat top left/cover;"></div> - <div id="background-mobile" style="background: url(<?= $bg_mobile ?>) no-repeat top left/cover;"></div> - <article id="loginbox"> - <header> - <h1><?= htmlReady(Config::get()->UNI_NAME_CLEAN) ?></h1> - </header> - <nav> - <ul> - <? foreach (Navigation::getItem('/login') as $key => $nav) : ?> - <? if ($nav->isVisible()) : ?> - <? $name_and_title = explode(' - ', $nav->getTitle()) ?> - <li class="login_link"> - <? if (is_internal_url($url = $nav->getURL())) : ?> - <? SkipLinks::addLink($name_and_title[0], $url) ?> - <a href="<?= URLHelper::getLink($url) ?>"> - <? else : ?> - <a href="<?= htmlReady($url) ?>" target="_blank" rel="noopener noreferrer"> - <? endif ?> - <?= htmlReady($name_and_title[0]) ?> - <p> - <?= htmlReady(!empty($name_and_title[1]) ? $name_and_title[1] : $nav->getDescription()) ?> - </p> - </a> - </li> - <? endif ?> - <? endforeach ?> - </ul> - </nav> - <footer> - <? if ($GLOBALS['UNI_LOGIN_ADD']) : ?> - <div class="uni_login_add"> - <?= $GLOBALS['UNI_LOGIN_ADD'] ?> - </div> - <? endif; ?> - <form method="POST" action="index.php"> - <?=CSRFProtection::tokenTag()?> - <input type="hidden" name="user_config_submitted" value="1"> - <div id="languages"> - <? foreach ($GLOBALS['INSTALLED_LANGUAGES'] as $temp_language_key => $temp_language): ?> - <?= Assets::img('languages/' . $temp_language['picture'], ['alt' => $temp_language['name'], 'size' => '24']) ?> - <button class="as-link" name="set_language_<?=$temp_language_key?>"> - <?= htmlReady($temp_language['name']) ?> - </button> - <? endforeach; ?> - </div> - <div id="contrast"> - <?=CSRFProtection::tokenTag()?> - <? if (!empty($_SESSION['contrast'])) : ?> - <?= Icon::create('accessibility')->asImg(24) ?> - <button class="as-link" name="unset_contrast"><?= _('Normalen Kontrast aktivieren') ?></button> - <?= tooltipIcon(_('Aktiviert standardmäßige, nicht barrierefreie Kontraste.')); ?> - <? else : ?> - <?= Icon::create('accessibility')->asImg(24) ?> - <button class="as-link" name="set_contrast"><?= _('Hohen Kontrast aktivieren') ?></button> - <?= tooltipIcon(_('Aktiviert einen hohen Kontrast gemäß WCAG 2.1. Diese Einstellung wird nach dem Login übernommen. - Sie können sie in Ihren persönlichen Einstellungen ändern.')); ?> - <? endif ?> - </div> - </form> - </footer> - </article> - - <? if (count($plugin_contents) > 0): ?> - <div id="login-plugin-contents"> - <? foreach ($plugin_contents as $content): ?> - <?= $content ?> - <? endforeach; ?> - </div> - <? endif; ?> -</main> diff --git a/templates/loginform.php b/templates/loginform.php index 27f55a73970e568fda110bb2eae457361ac666b2..66a87a71a07d8228a2ef91172a63eb81e7649641 100644 --- a/templates/loginform.php +++ b/templates/loginform.php @@ -97,27 +97,31 @@ $show_hidden_login = false; </div> <? endif ?> + <form method="POST" action="<?=URLHelper::getLink(Request::url(), ['cancel_login' => null])?>"> + <?=CSRFProtection::tokenTag()?> + <input type="hidden" name="user_config_submitted" value="1"> <div id="languages"> <? foreach ($GLOBALS['INSTALLED_LANGUAGES'] as $temp_language_key => $temp_language): ?> <?= Assets::img('languages/' . $temp_language['picture'], ['alt' => $temp_language['name'], 'size' => '24']) ?> - <a href="<?= URLHelper::getLink('index.php', ['set_language' =>$temp_language_key ]) ?>"> + <button class="as-link" name="set_language_<?=$temp_language_key?>"> <?= htmlReady($temp_language['name']) ?> - </a> - <? endforeach ?> + </button> + <? endforeach; ?> </div> - <div id="contrast"> - <? if (isset($_SESSION['contrast'])) : ?> + <?=CSRFProtection::tokenTag()?> + <? if (!empty($_SESSION['contrast'])) : ?> <?= Icon::create('accessibility')->asImg(24) ?> - <a href="<?= URLHelper::getLink('index.php', ['unset_contrast' => 1, 'cancel_login' => 1]) ?>"><?= _('Normalen Kontrast aktivieren') ?></a> + <button class="as-link" name="unset_contrast"><?= _('Normalen Kontrast aktivieren') ?></button> <?= tooltipIcon(_('Aktiviert standardmäßige, nicht barrierefreie Kontraste.')); ?> <? else : ?> <?= Icon::create('accessibility')->asImg(24) ?> - <a href="<?= URLHelper::getLink('index.php', ['set_contrast' => 1, 'cancel_login' => 1]) ?>" id="highcontrastlink"><?= _('Hohen Kontrast aktivieren')?></a> - <?= tooltipIcon(_('Aktiviert einen hohen Kontrast gemäß WCAG 2.1. Diese Einstellung wird nach dem Login übernommen.' - . 'Sie können sie in Ihren persönlichen Einstellungen ändern.')); ?> + <button class="as-link" name="set_contrast"><?= _('Hohen Kontrast aktivieren') ?></button> + <?= tooltipIcon(_('Aktiviert einen hohen Kontrast gemäß WCAG 2.1. Diese Einstellung wird nach dem Login übernommen. + Sie können sie in Ihren persönlichen Einstellungen ändern.')); ?> <? endif ?> </div> + </form> </footer> </div>