Skip to content
Snippets Groups Projects
Commit af54012b authored by André Noack's avatar André Noack
Browse files

Resolve #3606 "Änderungen aus MR !1905 sind durch den Login Step wieder verloren gegangen"

Closes #3606

Merge request studip/studip!2501
parent 30424199
No related branches found
No related tags found
No related merge requests found
...@@ -301,24 +301,21 @@ class Seminar_Auth ...@@ -301,24 +301,21 @@ class Seminar_Auth
throw new AccessDeniedException(); throw new AccessDeniedException();
} }
// if desired, switch to high contrast stylesheet and store when user logs in if (Request::submitted('user_config_submitted')) {
if (Request::get('unset_contrast')) { CSRFProtection::verifyUnsafeRequest();
unset($_SESSION['contrast']); if (Request::submitted('unset_contrast')) {
PageLayout::removeStylesheet('accessibility.css'); $_SESSION['contrast'] = 0;
}
} if (Request::submitted('set_contrast')) {
if (Request::get('set_contrast') ) { $_SESSION['contrast'] = 1;
$_SESSION['contrast'] = true; }
PageLayout::addStylesheet('accessibility.css');
}
// evaluate language clicks foreach (array_keys($GLOBALS['INSTALLED_LANGUAGES']) as $language_key) {
// has to be done before seminar_open to get switching back to german (no init of i18n at all)) if (Request::submitted('set_language_' . $language_key)) {
if (Request::get('set_language')) { $_SESSION['forced_language'] = $language_key;
if (array_key_exists(Request::get('set_language'), $GLOBALS['INSTALLED_LANGUAGES'])) { $_SESSION['_language'] = $language_key;
$_SESSION['forced_language'] = Request::get('set_language'); }
$_SESSION['_language'] = Request::get('set_language');
} }
} }
......
...@@ -21,45 +21,8 @@ require '../lib/bootstrap.php'; ...@@ -21,45 +21,8 @@ require '../lib/bootstrap.php';
page_open(['sess' => 'Seminar_Session', 'auth' => 'Seminar_Default_Auth', 'perm' => 'Seminar_Perm', 'user' => 'Seminar_User']); 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'); $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 new start page is in use, redirect there (if logged in)
if ($auth->is_authenticated() && $user->id != 'nobody') { if ($auth->is_authenticated() && $user->id != 'nobody') {
......
...@@ -108,9 +108,6 @@ $gap-between-boxes: calc($login-page-margin / 2); ...@@ -108,9 +108,6 @@ $gap-between-boxes: calc($login-page-margin / 2);
font-size: 0.9em; font-size: 0.9em;
padding: 10px; padding: 10px;
button {
text-decoration: underline;
}
} }
#contrast { #contrast {
......
<?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>
...@@ -97,27 +97,31 @@ $show_hidden_login = false; ...@@ -97,27 +97,31 @@ $show_hidden_login = false;
</div> </div>
<? endif ?> <? 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"> <div id="languages">
<? foreach ($GLOBALS['INSTALLED_LANGUAGES'] as $temp_language_key => $temp_language): ?> <? foreach ($GLOBALS['INSTALLED_LANGUAGES'] as $temp_language_key => $temp_language): ?>
<?= Assets::img('languages/' . $temp_language['picture'], ['alt' => $temp_language['name'], 'size' => '24']) ?> <?= 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']) ?> <?= htmlReady($temp_language['name']) ?>
</a> </button>
<? endforeach ?> <? endforeach; ?>
</div> </div>
<div id="contrast"> <div id="contrast">
<? if (isset($_SESSION['contrast'])) : ?> <?=CSRFProtection::tokenTag()?>
<? if (!empty($_SESSION['contrast'])) : ?>
<?= Icon::create('accessibility')->asImg(24) ?> <?= 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.')); ?> <?= tooltipIcon(_('Aktiviert standardmäßige, nicht barrierefreie Kontraste.')); ?>
<? else : ?> <? else : ?>
<?= Icon::create('accessibility')->asImg(24) ?> <?= Icon::create('accessibility')->asImg(24) ?>
<a href="<?= URLHelper::getLink('index.php', ['set_contrast' => 1, 'cancel_login' => 1]) ?>" id="highcontrastlink"><?= _('Hohen Kontrast aktivieren')?></a> <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.' <?= 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.')); ?> Sie können sie in Ihren persönlichen Einstellungen ändern.')); ?>
<? endif ?> <? endif ?>
</div> </div>
</form>
</footer> </footer>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment