blob: 7f7326289b2bdd9d2e3087152430b7308f252ea6 [file] [log] [blame]
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001<?php
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02002if (isset($_SESSION['mailcow_cc_role'])) {
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01003?>
4<div class="modal fade" id="YubiOTPModal" tabindex="-1" role="dialog" aria-labelledby="YubiOTPModalLabel">
5 <div class="modal-dialog" role="document">
6 <div class="modal-content">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02007 <div class="modal-header">
8 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
9 <h3 class="modal-title"><?=$lang['tfa']['yubi_otp'];?></h3>
10 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010011 <div class="modal-body">
12 <form role="form" method="post">
13 <div class="form-group">
14 <input type="text" class="form-control" name="key_id" placeholder="<?=$lang['tfa']['key_id'];?>" autocomplete="off" required>
15 </div>
16 <hr>
17 <p class="help-block"><?=sprintf($lang['tfa']['api_register'], $UI_TEXTS['main_name']);?></p>
18 <div class="form-group">
19 <input type="text" class="form-control" name="yubico_id" placeholder="Yubico API ID" autocomplete="off" required>
20 </div>
21 <div class="form-group">
22 <input type="text" class="form-control" name="yubico_key" placeholder="Yubico API Key" autocomplete="off" required>
23 </div>
24 <hr>
25 <div class="form-group">
26 <input type="password" class="form-control" name="confirm_password" placeholder="<?=$lang['user']['password_now'];?>" autocomplete="off" required>
27 </div>
28 <div class="form-group">
29 <div class="input-group">
30 <span class="input-group-addon" id="yubi-addon"><img alt="Yubicon Icon" src="/img/yubi.ico"></span>
31 <input type="text" name="otp_token" class="form-control" placeholder="Touch Yubikey" aria-describedby="yubi-addon">
32 <input type="hidden" name="tfa_method" value="yubi_otp">
33 </div>
34 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020035 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" type="submit" name="set_tfa"><?=$lang['user']['save_changes'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010036 </form>
37 </div>
38 </div>
39 </div>
40</div>
41
42<div class="modal fade" id="U2FModal" tabindex="-1" role="dialog" aria-labelledby="U2FModalLabel">
43 <div class="modal-dialog" role="document">
44 <div class="modal-content">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020045 <div class="modal-header">
46 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
47 <h3 class="modal-title"><?=$lang['tfa']['u2f'];?></h3>
48 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010049 <div class="modal-body">
50 <form role="form" method="post" id="u2f_reg_form">
51 <div class="form-group">
52 <input type="text" class="form-control" name="key_id" placeholder="<?=$lang['tfa']['key_id'];?>" autocomplete="off" required>
53 </div>
54 <div class="form-group">
55 <input type="password" class="form-control" name="confirm_password" placeholder="<?=$lang['user']['password_now'];?>" autocomplete="off" required>
56 </div>
57 <hr>
58 <center>
59 <div style="cursor:pointer" id="start_u2f_register">
60 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24">
61 <path d="M17.81 4.47c-.08 0-.16-.02-.23-.06C15.66 3.42 14 3 12.01 3c-1.98 0-3.86.47-5.57 1.41-.24.13-.54.04-.68-.2-.13-.24-.04-.55.2-.68C7.82 2.52 9.86 2 12.01 2c2.13 0 3.99.47 6.03 1.52.25.13.34.43.21.67-.09.18-.26.28-.44.28zM3.5 9.72c-.1 0-.2-.03-.29-.09-.23-.16-.28-.47-.12-.7.99-1.4 2.25-2.5 3.75-3.27C9.98 4.04 14 4.03 17.15 5.65c1.5.77 2.76 1.86 3.75 3.25.16.22.11.54-.12.7-.23.16-.54.11-.7-.12-.9-1.26-2.04-2.25-3.39-2.94-2.87-1.47-6.54-1.47-9.4.01-1.36.7-2.5 1.7-3.4 2.96-.08.14-.23.21-.39.21zm6.25 12.07c-.13 0-.26-.05-.35-.15-.87-.87-1.34-1.43-2.01-2.64-.69-1.23-1.05-2.73-1.05-4.34 0-2.97 2.54-5.39 5.66-5.39s5.66 2.42 5.66 5.39c0 .28-.22.5-.5.5s-.5-.22-.5-.5c0-2.42-2.09-4.39-4.66-4.39-2.57 0-4.66 1.97-4.66 4.39 0 1.44.32 2.77.93 3.85.64 1.15 1.08 1.64 1.85 2.42.19.2.19.51 0 .71-.11.1-.24.15-.37.15zm7.17-1.85c-1.19 0-2.24-.3-3.1-.89-1.49-1.01-2.38-2.65-2.38-4.39 0-.28.22-.5.5-.5s.5.22.5.5c0 1.41.72 2.74 1.94 3.56.71.48 1.54.71 2.54.71.24 0 .64-.03 1.04-.1.27-.05.53.13.58.41.05.27-.13.53-.41.58-.57.11-1.07.12-1.21.12zM14.91 22c-.04 0-.09-.01-.13-.02-1.59-.44-2.63-1.03-3.72-2.1-1.4-1.39-2.17-3.24-2.17-5.22 0-1.62 1.38-2.94 3.08-2.94 1.7 0 3.08 1.32 3.08 2.94 0 1.07.93 1.94 2.08 1.94s2.08-.87 2.08-1.94c0-3.77-3.25-6.83-7.25-6.83-2.84 0-5.44 1.58-6.61 4.03-.39.81-.59 1.76-.59 2.8 0 .78.07 2.01.67 3.61.1.26-.03.55-.29.64-.26.1-.55-.04-.64-.29-.49-1.31-.73-2.61-.73-3.96 0-1.2.23-2.29.68-3.24 1.33-2.79 4.28-4.6 7.51-4.6 4.55 0 8.25 3.51 8.25 7.83 0 1.62-1.38 2.94-3.08 2.94s-3.08-1.32-3.08-2.94c0-1.07-.93-1.94-2.08-1.94s-2.08.87-2.08 1.94c0 1.71.66 3.31 1.87 4.51.95.94 1.86 1.46 3.27 1.85.27.07.42.35.35.61-.05.23-.26.38-.47.38z"></path>
62 </svg>
63 <p><?=$lang['tfa']['start_u2f_validation'];?></p>
64 <hr>
65 </div>
66 </center>
67 <p id="u2f_status_reg"></p>
68 <div class="alert alert-danger" style="display:none" id="u2f_return_code"></div>
69 <input type="hidden" name="token" id="u2f_register_data"/>
70 <input type="hidden" name="tfa_method" value="u2f">
71 <input type="hidden" name="set_tfa"/><br/>
72 </form>
73 </div>
74 </div>
75 </div>
76</div>
77
78<div class="modal fade" id="TOTPModal" tabindex="-1" role="dialog" aria-labelledby="TOTPModalLabel">
79 <div class="modal-dialog" role="document">
80 <div class="modal-content">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020081 <div class="modal-header">
82 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
83 <h3 class="modal-title"><?=$lang['tfa']['totp'];?></h3>
84 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010085 <div class="modal-body">
86 <form role="form" method="post">
87 <div class="form-group">
88 <input type="text" class="form-control" name="key_id" placeholder="<?=$lang['tfa']['key_id_totp'];?>" autocomplete="off" required>
89 </div>
90 <div class="form-group">
91 <input type="password" class="form-control" name="confirm_password" placeholder="<?=$lang['user']['password_now'];?>" autocomplete="off" required>
92 </div>
93 <hr>
94 <?php
95 $totp_secret = $tfa->createSecret();
96 ?>
97 <input type="hidden" value="<?=$totp_secret;?>" name="totp_secret">
98 <input type="hidden" name="tfa_method" value="totp">
99 <ol>
100 <li>
101 <p><?=$lang['tfa']['scan_qr_code'];?></p>
102 <img id="tfa-qr-img" data-totp-secret="<?=$totp_secret;?>" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=">
103 <p class="help-block"><?=$lang['tfa']['enter_qr_code'];?>:<br />
104 <code><?=$totp_secret;?></code>
105 </p>
106 </li>
107 <li>
108 <p><?=$lang['tfa']['confirm_totp_token'];?>:</p>
109 <p><input type="number" style="width:33%" class="form-control" name="totp_confirm_token" autocomplete="off" required></p>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200110 <p><button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" type="submit" name="set_tfa"><?=$lang['tfa']['confirm'];?></button></p>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100111 </li>
112 </ol>
113 </form>
114 </div>
115 </div>
116 </div>
117</div>
118
119<div class="modal fade" id="DisableTFAModal" tabindex="-1" role="dialog" aria-labelledby="DisableTFAModalLabel">
120 <div class="modal-dialog" role="document">
121 <div class="modal-content">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200122 <div class="modal-header">
123 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
124 <h3 class="modal-title"><?=$lang['tfa']['delete_tfa'];?></h3>
125 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100126 <div class="modal-body">
127 <form role="form" method="post">
128 <div class="input-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200129 <input type="password" class="form-control input-xs-lg" name="confirm_password" placeholder="<?=$lang['user']['password_now'];?>" autocomplete="off" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100130 <span class="input-group-btn">
131 <input type="hidden" name="tfa_method" value="none">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200132 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-danger" type="submit" name="set_tfa"><?=str_replace(' ', '&nbsp;', $lang['tfa']['delete_tfa']);?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100133 </span>
134 </div>
135 </form>
136 </div>
137 </div>
138 </div>
139</div>
140
141<?php
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200142}
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100143if (isset($_SESSION['pending_tfa_method'])):
144 $tfa_method = $_SESSION['pending_tfa_method'];
145?>
146<div class="modal fade" id="ConfirmTFAModal" tabindex="-1" role="dialog" aria-labelledby="ConfirmTFAModalLabel">
147 <div class="modal-dialog" role="document">
148 <div class="modal-content">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200149 <div class="modal-header">
150 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
151 <h3 class="modal-title"><?=$lang['tfa'][$tfa_method];?></h3>
152 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100153 <div class="modal-body">
154 <?php
155 switch ($tfa_method) {
156 case "yubi_otp":
157 ?>
158 <form role="form" method="post">
159 <div class="form-group">
160 <div class="input-group">
161 <span class="input-group-addon" id="yubi-addon"><img alt="Yubicon Icon" src="/img/yubi.ico"></span>
162 <input type="text" name="token" class="form-control" autocomplete="off" placeholder="Touch Yubikey" aria-describedby="yubi-addon">
163 <input type="hidden" name="tfa_method" value="yubi_otp">
164 </div>
165 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200166 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-sm btn-default" type="submit" name="verify_tfa_login"><?=$lang['login']['login'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100167 </form>
168 <?php
169 break;
170 case "u2f":
171 ?>
172 <form role="form" method="post" id="u2f_auth_form">
173 <center>
174 <div id="start_u2f_confirmation">
175 <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24">
176 <path d="M17.81 4.47c-.08 0-.16-.02-.23-.06C15.66 3.42 14 3 12.01 3c-1.98 0-3.86.47-5.57 1.41-.24.13-.54.04-.68-.2-.13-.24-.04-.55.2-.68C7.82 2.52 9.86 2 12.01 2c2.13 0 3.99.47 6.03 1.52.25.13.34.43.21.67-.09.18-.26.28-.44.28zM3.5 9.72c-.1 0-.2-.03-.29-.09-.23-.16-.28-.47-.12-.7.99-1.4 2.25-2.5 3.75-3.27C9.98 4.04 14 4.03 17.15 5.65c1.5.77 2.76 1.86 3.75 3.25.16.22.11.54-.12.7-.23.16-.54.11-.7-.12-.9-1.26-2.04-2.25-3.39-2.94-2.87-1.47-6.54-1.47-9.4.01-1.36.7-2.5 1.7-3.4 2.96-.08.14-.23.21-.39.21zm6.25 12.07c-.13 0-.26-.05-.35-.15-.87-.87-1.34-1.43-2.01-2.64-.69-1.23-1.05-2.73-1.05-4.34 0-2.97 2.54-5.39 5.66-5.39s5.66 2.42 5.66 5.39c0 .28-.22.5-.5.5s-.5-.22-.5-.5c0-2.42-2.09-4.39-4.66-4.39-2.57 0-4.66 1.97-4.66 4.39 0 1.44.32 2.77.93 3.85.64 1.15 1.08 1.64 1.85 2.42.19.2.19.51 0 .71-.11.1-.24.15-.37.15zm7.17-1.85c-1.19 0-2.24-.3-3.1-.89-1.49-1.01-2.38-2.65-2.38-4.39 0-.28.22-.5.5-.5s.5.22.5.5c0 1.41.72 2.74 1.94 3.56.71.48 1.54.71 2.54.71.24 0 .64-.03 1.04-.1.27-.05.53.13.58.41.05.27-.13.53-.41.58-.57.11-1.07.12-1.21.12zM14.91 22c-.04 0-.09-.01-.13-.02-1.59-.44-2.63-1.03-3.72-2.1-1.4-1.39-2.17-3.24-2.17-5.22 0-1.62 1.38-2.94 3.08-2.94 1.7 0 3.08 1.32 3.08 2.94 0 1.07.93 1.94 2.08 1.94s2.08-.87 2.08-1.94c0-3.77-3.25-6.83-7.25-6.83-2.84 0-5.44 1.58-6.61 4.03-.39.81-.59 1.76-.59 2.8 0 .78.07 2.01.67 3.61.1.26-.03.55-.29.64-.26.1-.55-.04-.64-.29-.49-1.31-.73-2.61-.73-3.96 0-1.2.23-2.29.68-3.24 1.33-2.79 4.28-4.6 7.51-4.6 4.55 0 8.25 3.51 8.25 7.83 0 1.62-1.38 2.94-3.08 2.94s-3.08-1.32-3.08-2.94c0-1.07-.93-1.94-2.08-1.94s-2.08.87-2.08 1.94c0 1.71.66 3.31 1.87 4.51.95.94 1.86 1.46 3.27 1.85.27.07.42.35.35.61-.05.23-.26.38-.47.38z"></path>
177 </svg>
178 <p><?=$lang['tfa']['start_u2f_validation'];?></p>
179 <hr>
180 </div>
181 </center>
182 <p id="u2f_status_auth"></p>
183 <div class="alert alert-danger" style="display:none" id="u2f_return_code"></div>
184 <input type="hidden" name="token" id="u2f_auth_data"/>
185 <input type="hidden" name="tfa_method" value="u2f">
186 <input type="hidden" name="verify_tfa_login"/><br/>
187 </form>
188 <?php
189 break;
190 case "totp":
191 ?>
192 <form role="form" method="post">
193 <div class="form-group">
194 <div class="input-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200195 <span class="input-group-addon" id="tfa-addon"><i class="bi bi-shield-lock-fill"></i></span>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100196 <input type="number" min="000000" max="999999" name="token" class="form-control" placeholder="123456" autocomplete="one-time-code" aria-describedby="tfa-addon">
197 <input type="hidden" name="tfa_method" value="totp">
198 </div>
199 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200200 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" type="submit" name="verify_tfa_login"><?=$lang['login']['login'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100201 </form>
202 <?php
203 break;
204 case "hotp":
205 ?>
206 <div class="empty"></div>
207 <?php
208 break;
209 }
210 ?>
211 </div>
212 </div>
213 </div>
214</div>
215<?php
216endif;
217if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'admin'):
218?>
219<div id="RestartContainer" class="modal fade" role="dialog">
220 <div class="modal-dialog">
221 <div class="modal-content">
222 <div class="modal-header">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200223 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100224 <h4 class="modal-title"><?= $lang['footer']['restart_container']; ?> (<code id="containerName"></code>)</h4>
225 </div>
226 <div class="modal-body">
227 <p><?= $lang['footer']['restart_container_info']; ?></p>
228 <hr>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200229 <button class="btn btn-md visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-primary" id="triggerRestartContainer"><?= $lang['footer']['restart_now']; ?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100230 <br><br>
231 <div id="statusTriggerRestartContainer"></div>
232 </div>
233 </div>
234 </div>
235</div>
236<?php
237endif;
238?>
239<div id="ConfirmDeleteModal" class="modal fade" role="dialog">
240 <div class="modal-dialog">
241 <div class="modal-content">
242 <div class="modal-header">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200243 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
244 <h3 class="modal-title"><?= $lang['footer']['confirm_delete']; ?></h3>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100245 </div>
246 <div class="modal-body">
247 <p id="DeleteText"><?= $lang['footer']['delete_these_items']; ?></p>
248 <ul id="ItemsToDelete"></ul>
249 <hr>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200250 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-danger" id="IsConfirmed"><?= $lang['footer']['delete_now']; ?></button>
251 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" id="isCanceled"><?= $lang['footer']['cancel']; ?></button>
252 <div class="clearfix visible-xs"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100253 </div>
254 </div>
255 </div>
256</div>