blob: c319d5ef6175c9c2285e25b5effe9b4005a839d7 [file] [log] [blame]
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001<?php
2require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
3
4if (isset($_SESSION['mailcow_cc_role']) && isset($_SESSION['oauth2_request'])) {
5 $oauth2_request = $_SESSION['oauth2_request'];
6 unset($_SESSION['oauth2_request']);
7 header('Location: ' . $oauth2_request);
8 exit();
9}
10elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'admin') {
11 header('Location: /admin');
12 exit();
13}
14elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'domainadmin') {
15 header('Location: /mailbox');
16 exit();
17}
18elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'user') {
19 header('Location: /user');
20 exit();
21}
22
23require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
24$_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
25$_SESSION['index_query_string'] = $_SERVER['QUERY_STRING'];
26
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010027$template = 'index.twig';
28$template_data = [
29 'oauth2_request' => @$_SESSION['oauth2_request'],
30 'is_mobileconfig' => str_contains($_SESSION['index_query_string'], 'mobileconfig'),
31 'login_delay' => @$_SESSION['ldelay'],
32];
33
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010034$js_minifier->add('/web/js/site/index.js');
35require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';