| Matthias Andreas Benkard | 97f1202 | 2026-10-23 08:46:40 +0200 | [diff] [blame^] | 1 | <?php |
| 2 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php'; |
| 3 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/triggers.admin.inc.php'; |
| 4 | |
| 5 | if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'admin') { |
| 6 | // Only redirect to dashboard if NO pending actions |
| 7 | if (empty($_SESSION['pending_tfa_setup']) && empty($_SESSION['pending_pw_update'])) { |
| 8 | header('Location: /admin/dashboard'); |
| 9 | exit(); |
| 10 | } |
| 11 | } |
| 12 | elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'domainadmin') { |
| 13 | header('Location: /domainadmin/mailbox'); |
| 14 | exit(); |
| 15 | } |
| 16 | elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'user') { |
| 17 | header('Location: /user'); |
| 18 | exit(); |
| 19 | } |
| 20 | |
| 21 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php'; |
| 22 | $_SESSION['return_to'] = $_SERVER['REQUEST_URI']; |
| 23 | $_SESSION['index_query_string'] = $_SERVER['QUERY_STRING']; |
| 24 | |
| 25 | |
| 26 | $template = 'admin_index.twig'; |
| 27 | $template_data = [ |
| 28 | 'login_delay' => @$_SESSION['ldelay'], |
| 29 | 'custom_login' => customize('get', 'custom_login'), |
| 30 | ]; |
| 31 | |
| 32 | $js_minifier->add('/web/js/site/index.js'); |
| 33 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php'; |