blob: 93e72a7710ad092dbaaec28cc12a9f8a6bda1570 [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
27?>
28<div class="container">
29 <div class="row">
30 <div class="col-md-offset-3 col-md-6">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020031 <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 Benkardb382b102021-01-02 15:32:21 +010033 <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 Benkard7b2a3a12021-08-16 10:57:25 +020036 <div class="alert alert-<?=$UI_TEXTS['ui_announcement_type'];?> rot-enc ui-announcement-alert"><?=str_rot13($UI_TEXTS['ui_announcement_text']);?></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010037 <?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 Benkard7b2a3a12021-08-16 10:57:25 +020050 <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 Benkardb382b102021-01-02 15:32:21 +010052 </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 Benkard7b2a3a12021-08-16 10:57:25 +020057 <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 Benkardb382b102021-01-02 15:32:21 +010059 </div>
60 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020061 <div class="form-group" style="position: relative">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010062 <div class="btn-group">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010063 <div class="btn-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020064 <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 Benkardb382b102021-01-02 15:32:21 +010070 </ul>
71 </div>
72 </div>
73 <?php if(!isset($_SESSION['oauth2_request'])) { ?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020074 <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 Benkardb382b102021-01-02 15:32:21 +010076 </button>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020077 <ul class="dropdown-menu pull-right login">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010078 <?php
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020079 foreach ($AVAILABLE_LANGUAGES as $c => $v) {
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010080 ?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020081 <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 Benkardb382b102021-01-02 15:32:21 +010082 <?php } ?>
83 </ul>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010084 <?php } ?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020085 <div class="clearfix"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010086 </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 Benkard7b2a3a12021-08-16 10:57:25 +020095 <legend><i class="bi bi-link-45deg"></i> <?=$UI_TEXTS['apps_name'];?></legend>
96 <div class="apps">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010097 <?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 Benkard7b2a3a12021-08-16 10:57:25 +0200102 <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 Benkardb382b102021-01-02 15:32:21 +0100105 <?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 Benkard7b2a3a12021-08-16 10:57:25 +0200113 <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 Benkardb382b102021-01-02 15:32:21 +0100116 <?php
117 }
118 }
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200119 } ?>
120 </div>
121 <?php }
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100122 ?>
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 Benkard7b2a3a12021-08-16 10:57:25 +0200130 <a data-toggle="collapse" href="#collapse1"><i class="bi bi-patch-question-fill"></i> <?= $lang['start']['help']; ?></a>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100131 </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');
151require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';