Support alternative home sites

This commit is contained in:
Janne Heß 2019-03-07 13:01:52 +01:00 committed by msquare
parent cd2f78924b
commit afa4506e11
4 changed files with 10 additions and 3 deletions

View File

@ -69,6 +69,10 @@ return [
// Rewrite URLs with mod_rewrite // Rewrite URLs with mod_rewrite
'rewrite_urls' => true, 'rewrite_urls' => true,
// Redirect to this site after logging in or when pressing the top-left button
// Must be one of news, user_meetings, user_shifts, angeltypes, user_questions
'home_site' => 'news',
// Number of News shown on one site // Number of News shown on one site
'display_news' => 6, 'display_news' => 6,

View File

@ -414,7 +414,7 @@ function guest_login()
$session->set('uid', $login_user->id); $session->set('uid', $login_user->id);
$session->set('locale', $login_user->settings->language); $session->set('locale', $login_user->settings->language);
redirect(page_link_to('news')); redirect(page_link_to(config('home_site')));
} }
} }

View File

@ -118,7 +118,10 @@ function load_days()
if (empty($days)) { if (empty($days)) {
error(__('The administration has not configured any shifts yet.')); error(__('The administration has not configured any shifts yet.'));
redirect(page_link_to('/')); // Do not try to redirect to the current page
if (config('home_site') != 'user_shifts') {
redirect(page_link_to('/'));
}
} }
return $days; return $days;
} }

View File

@ -71,7 +71,7 @@ class LegacyMiddleware implements MiddlewareInterface
$page = str_replace('-', '_', $page); $page = str_replace('-', '_', $page);
} }
if ($page == '/') { if ($page == '/') {
$page = $this->auth->user() ? 'news' : 'login'; $page = $this->auth->user() ? config('home_site') : 'login';
} }
$title = $content = ''; $title = $content = '';