Skip to content
Snippets Groups Projects
Commit 837d45b6 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

load login faq entries only if configuration has been set accordingly, fixes #4997

Closes #4997

Merge request studip/studip!3751
parent 6b4b5b6d
No related branches found
No related tags found
No related merge requests found
...@@ -344,12 +344,16 @@ class Seminar_Auth ...@@ -344,12 +344,16 @@ class Seminar_Auth
if (isset($this->auth['uname']) && $this->error_msg) { if (isset($this->auth['uname']) && $this->error_msg) {
PageLayout::postError(_('Bei der Anmeldung trat ein Fehler auf!'), $this->error_msg); PageLayout::postError(_('Bei der Anmeldung trat ein Fehler auf!'), $this->error_msg);
} }
$login_template->set_attribute('error_msg', $this->error_msg); $login_template->error_msg = $this->error_msg;
$login_template->set_attribute('uname', (isset($this->auth["uname"]) ? $this->auth["uname"] : Request::username('loginname'))); $login_template->uname = $this->auth['uname'] ?? Request::username('loginname');
$login_template->set_attribute('self_registration_activated', Config::get()->ENABLE_SELF_REGISTRATION); $login_template->self_registration_activated = Config::get()->ENABLE_SELF_REGISTRATION;
$login_template->set_attribute('logout', Request::bool('logout', false)); $login_template->logout = Request::bool('logout', false);
$login_template->set_attribute('faq_entries', LoginFaq::findBySQL("1")); $login_template->faq_entries = [];
$login_template->set_attribute('news_entries', array_values($news_entries)); $login_template->news_entries = array_values($news_entries);
if (Config::get()->getValue('LOGIN_FAQ_VISIBILITY')) {
$login_template->faq_entries = LoginFaq::findBySQL('1');
}
} }
PageLayout::setHelpKeyword('Basis.AnmeldungLogin'); PageLayout::setHelpKeyword('Basis.AnmeldungLogin');
$header_template = $GLOBALS['template_factory']->open('header'); $header_template = $GLOBALS['template_factory']->open('header');
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/** /**
* @var array $loginerror * @var array $loginerror
* @var string $error_msg * @var string $error_msg
* @var LoginFaq[] $faq_entries
*/ */
// Get background images (this should be resolved differently since mobile // Get background images (this should be resolved differently since mobile
...@@ -25,7 +26,7 @@ if (!match_route('web_migrate.php')) { ...@@ -25,7 +26,7 @@ if (!match_route('web_migrate.php')) {
} }
$show_login = !(current(StudipAuthAbstract::getInstance()) instanceof StudipAuthSSO) && StudipAuthAbstract::isLoginEnabled(); $show_login = !(current(StudipAuthAbstract::getInstance()) instanceof StudipAuthSSO) && StudipAuthAbstract::isLoginEnabled();
$show_hidden_login = !$show_login && StudipAuthAbstract::isLoginEnabled(); $show_hidden_login = !$show_login && StudipAuthAbstract::isLoginEnabled();
$enable_faq = Config::get()->LOGIN_FAQ_VISIBILITY && count($faq_entries) > 0; $enable_faq = count($faq_entries) > 0;
$enable_news = Config::get()->LOGIN_NEWS_VISIBILITY && count($news_entries) > 0; $enable_news = Config::get()->LOGIN_NEWS_VISIBILITY && count($news_entries) > 0;
?> ?>
<main id="content" class="loginpage"> <main id="content" class="loginpage">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment