Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 1 | <?php |
| 2 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php'; |
| 3 | |
| 4 | if (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 | } |
| 10 | elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'admin') { |
| 11 | header('Location: /admin'); |
| 12 | exit(); |
| 13 | } |
| 14 | elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'domainadmin') { |
| 15 | header('Location: /mailbox'); |
| 16 | exit(); |
| 17 | } |
| 18 | elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'user') { |
| 19 | header('Location: /user'); |
| 20 | exit(); |
| 21 | } |
| 22 | |
| 23 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php'; |
| 24 | $_SESSION['return_to'] = $_SERVER['REQUEST_URI']; |
| 25 | $_SESSION['index_query_string'] = $_SERVER['QUERY_STRING']; |
| 26 | |
| 27 | ?> |
| 28 | <div class="container"> |
| 29 | <div class="row"> |
| 30 | <div class="col-md-offset-3 col-md-6"> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 31 | <div class="panel panel-default panel-login"> |
| 32 | <div class="panel-heading"><i class="bi bi-person-fill"></i> <?= $lang['login']['login']; ?></div> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 33 | <div class="panel-body"> |
| 34 | <div class="text-center mailcow-logo"><img src="<?=($main_logo = customize('get', 'main_logo')) ? $main_logo : '/img/cow_mailcow.svg';?>" alt="mailcow"></div> |
| 35 | <?php if (!empty($UI_TEXTS['ui_announcement_text']) && in_array($UI_TEXTS['ui_announcement_type'], array('info', 'warning', 'danger')) && $UI_TEXTS['ui_announcement_active'] == 1) { ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 36 | <div class="alert alert-<?=$UI_TEXTS['ui_announcement_type'];?> rot-enc ui-announcement-alert"><?=str_rot13($UI_TEXTS['ui_announcement_text']);?></div> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 37 | <?php } ?> |
| 38 | <legend><?= isset($_SESSION['oauth2_request']) ? $lang['oauth2']['authorize_app'] : $UI_TEXTS['main_name'];?></legend> |
| 39 | <?php |
| 40 | if (strpos($_SESSION['index_query_string'], 'mobileconfig') !== false) { |
| 41 | ?> |
| 42 | <div class="alert alert-info"><?= $lang['login']['mobileconfig_info']; ?></div> |
| 43 | <?php |
| 44 | } |
| 45 | ?> |
| 46 | <form method="post" autofill="off"> |
| 47 | <div class="form-group"> |
| 48 | <label class="sr-only" for="login_user"><?= $lang['login']['username']; ?></label> |
| 49 | <div class="input-group"> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 50 | <div class="input-group-addon"><i class="bi bi-person-fill"></i></div> |
| 51 | <input name="login_user" autocorrect="off" autocapitalize="none" type="<?=(strpos($_SESSION['index_query_string'], 'mobileconfig') !== false) ? 'email' : 'text';?>" id="login_user" class="form-control" placeholder="<?= $lang['login']['username']; ?>" required="" autofocus="" autocomplete="username"> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 52 | </div> |
| 53 | </div> |
| 54 | <div class="form-group"> |
| 55 | <label class="sr-only" for="pass_user"><?= $lang['login']['password']; ?></label> |
| 56 | <div class="input-group"> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 57 | <div class="input-group-addon"><i class="bi bi-lock-fill"></i></div> |
| 58 | <input name="pass_user" type="password" id="pass_user" class="form-control" placeholder="<?= $lang['login']['password']; ?>" required="" autocomplete="current-password"> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 59 | </div> |
| 60 | </div> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 61 | <div class="form-group" style="position: relative"> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 62 | <div class="btn-group"> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 63 | <div class="btn-group"> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 64 | <button type="submit" class="btn btn-xs-lg btn-success" value="Login"><?= $lang['login']['login']; ?></button> |
| 65 | <button type="button" class="btn btn-xs-lg btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
| 66 | <span class="caret"></span> |
| 67 | </button> |
| 68 | <ul class="dropdown-menu"> |
| 69 | <li><a href="#" id="fido2-login" style="line-height:1.4;"><i class="bi bi-shield-fill-check"></i> <?= $lang['login']['fido2_webauthn']; ?></a></li> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 70 | </ul> |
| 71 | </div> |
| 72 | </div> |
| 73 | <?php if(!isset($_SESSION['oauth2_request'])) { ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 74 | <button type="button" <?=(isset($_SESSION['mailcow_locale']) && count($AVAILABLE_LANGUAGES) === 1) ? 'disabled="true"' : '' ?> class="btn btn-xs-lg btn-default pull-right dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
| 75 | <span class="flag-icon flag-icon-<?= $_SESSION['mailcow_locale']; ?>"></span> <span class="caret"></span> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 76 | </button> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 77 | <ul class="dropdown-menu pull-right login"> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 78 | <?php |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 79 | foreach ($AVAILABLE_LANGUAGES as $c => $v) { |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 80 | ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 81 | <li<?= ($_SESSION['mailcow_locale'] == $c) ? ' class="active"' : ''; ?>><a href="?<?= http_build_query(array_merge($_GET, array('lang' => $c))) ?>"><span class="flag-icon flag-icon-<?=$c;?>"></span> <?=$v;?></a></li> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 82 | <?php } ?> |
| 83 | </ul> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 84 | <?php } ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 85 | <div class="clearfix"></div> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 86 | </div> |
| 87 | </form> |
| 88 | <?php |
| 89 | if (isset($_SESSION['ldelay']) && $_SESSION['ldelay'] != '0') { |
| 90 | ?> |
| 91 | <p><div class="alert alert-info"><?= sprintf($lang['login']['delayed'], $_SESSION['ldelay']); ?></b></div></p> |
| 92 | <?php } ?> |
| 93 | <div id="fido2-alerts"></div> |
| 94 | <?php if(!isset($_SESSION['oauth2_request'])) { ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 95 | <legend><i class="bi bi-link-45deg"></i> <?=$UI_TEXTS['apps_name'];?></legend> |
| 96 | <div class="apps"> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 97 | <?php |
| 98 | if (!empty($MAILCOW_APPS)) { |
| 99 | foreach ($MAILCOW_APPS as $app) { |
| 100 | if (getenv('SKIP_SOGO') == "y" && preg_match('/^\/SOGo/i', $app['link'])) { continue; } |
| 101 | ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 102 | <div class="media-clearfix"> |
| 103 | <a href="<?=(isset($app['link'])) ? htmlspecialchars($app['link']) : '';?>" role="button" title="<?=(isset($app['description'])) ? htmlspecialchars($app['description']) : '';?>" class="btn btn-primary btn-lg btn-block"><?= htmlspecialchars($app['name']); ?></a> |
| 104 | </div> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 105 | <?php |
| 106 | } |
| 107 | } |
| 108 | $app_links = customize('get', 'app_links'); |
| 109 | if (!empty($app_links)) { |
| 110 | foreach ($app_links as $row) { |
| 111 | foreach ($row as $key => $val) { |
| 112 | ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 113 | <div class="media-clearfix"> |
| 114 | <a href="<?= htmlspecialchars($val); ?>" role="button" class="btn btn-primary btn-lg btn-block"><?= htmlspecialchars($key); ?></a> |
| 115 | </div> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 116 | <?php |
| 117 | } |
| 118 | } |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 119 | } ?> |
| 120 | </div> |
| 121 | <?php } |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 122 | ?> |
| 123 | </div> |
| 124 | </div> |
| 125 | </div> |
| 126 | <?php if(!isset($_SESSION['oauth2_request'])) { ?> |
| 127 | <div class="col-md-offset-3 col-md-6"> |
| 128 | <div class="panel panel-default"> |
| 129 | <div class="panel-heading"> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 130 | <a data-toggle="collapse" href="#collapse1"><i class="bi bi-patch-question-fill"></i> <?= $lang['start']['help']; ?></a> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 131 | </div> |
| 132 | <div id="collapse1" class="panel-collapse collapse"> |
| 133 | <div class="panel-body"> |
| 134 | <?php if ($UI_TEXTS['help_text']) { ?> |
| 135 | <p><?=$UI_TEXTS['help_text'];?></p> |
| 136 | <?php } else { ?> |
| 137 | <p><span style="border-bottom: 1px dotted #999;"><?=$UI_TEXTS['main_name'];?></span></p> |
| 138 | <p><?= $lang['start']['mailcow_panel_detail']; ?></p> |
| 139 | <p><span style="border-bottom: 1px dotted #999;"><?=$UI_TEXTS['apps_name'];?></span></p> |
| 140 | <p><?= $lang['start']['mailcow_apps_detail']; ?></p> |
| 141 | <?php } ?> |
| 142 | </div> |
| 143 | </div> |
| 144 | </div> |
| 145 | </div> |
| 146 | <?php } ?> |
| 147 | </div> |
| 148 | </div><!-- /.container --> |
| 149 | <?php |
| 150 | $js_minifier->add('/web/js/site/index.js'); |
| 151 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php'; |