2
0

footer.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <?php
  2. if (isset($_SESSION['mailcow_cc_role']) && ($_SESSION['mailcow_cc_role'] == "admin" || $_SESSION['mailcow_cc_role'] == "domainadmin")):
  3. ?>
  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">
  7. <div class="modal-header"><b><?=$lang['tfa']['yubi_otp'];?></b></div>
  8. <div class="modal-body">
  9. <form role="form" method="post">
  10. <div class="form-group">
  11. <input type="text" class="form-control" name="key_id" placeholder="<?=$lang['tfa']['key_id'];?>" autocomplete="off" required>
  12. </div>
  13. <hr>
  14. <p class="help-block"><?=sprintf($lang['tfa']['api_register'], $UI_TEXTS['main_name']);?></p>
  15. <div class="form-group">
  16. <input type="text" class="form-control" name="yubico_id" placeholder="Yubico API ID" autocomplete="off" required>
  17. </div>
  18. <div class="form-group">
  19. <input type="text" class="form-control" name="yubico_key" placeholder="Yubico API Key" autocomplete="off" required>
  20. </div>
  21. <hr>
  22. <div class="form-group">
  23. <input type="password" class="form-control" name="confirm_password" placeholder="<?=$lang['user']['password_now'];?>" autocomplete="off" required>
  24. </div>
  25. <div class="form-group">
  26. <div class="input-group">
  27. <span class="input-group-addon" id="yubi-addon"><img alt="Yubicon Icon" src="/img/yubi.ico"></span>
  28. <input type="text" name="otp_token" class="form-control" placeholder="Touch Yubikey" aria-describedby="yubi-addon">
  29. <input type="hidden" name="tfa_method" value="yubi_otp">
  30. </div>
  31. </div>
  32. <button class="btn btn-sm btn-default" type="submit" name="set_tfa"><?=$lang['user']['save_changes'];?></button>
  33. </form>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="modal fade" id="U2FModal" tabindex="-1" role="dialog" aria-labelledby="U2FModalLabel">
  39. <div class="modal-dialog" role="document">
  40. <div class="modal-content">
  41. <div class="modal-header"><b><?=$lang['tfa']['u2f'];?></b></div>
  42. <div class="modal-body">
  43. <form role="form" method="post" id="u2f_reg_form">
  44. <div class="form-group">
  45. <input type="text" class="form-control" name="key_id" placeholder="<?=$lang['tfa']['key_id'];?>" autocomplete="off" required>
  46. </div>
  47. <div class="form-group">
  48. <input type="password" class="form-control" name="confirm_password" placeholder="<?=$lang['user']['password_now'];?>" autocomplete="off" required>
  49. </div>
  50. <hr>
  51. <center>
  52. <div style="cursor:pointer" id="start_u2f_register">
  53. <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24">
  54. <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>
  55. </svg>
  56. <p><?=$lang['tfa']['start_u2f_validation'];?></p>
  57. <hr>
  58. </div>
  59. </center>
  60. <p id="u2f_status_reg"></p>
  61. <div class="alert alert-danger" style="display:none" id="u2f_return_code"></div>
  62. <input type="hidden" name="token" id="u2f_register_data"/>
  63. <input type="hidden" name="tfa_method" value="u2f">
  64. <input type="hidden" name="set_tfa"/><br/>
  65. </form>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="modal fade" id="TOTPModal" tabindex="-1" role="dialog" aria-labelledby="TOTPModalLabel">
  71. <div class="modal-dialog" role="document">
  72. <div class="modal-content">
  73. <div class="modal-header"><b><?=$lang['tfa']['totp'];?></b></div>
  74. <div class="modal-body">
  75. <form role="form" method="post">
  76. <div class="form-group">
  77. <input type="text" class="form-control" name="key_id" placeholder="<?=$lang['tfa']['key_id_totp'];?>" autocomplete="off" required>
  78. </div>
  79. <div class="form-group">
  80. <input type="password" class="form-control" name="confirm_password" placeholder="<?=$lang['user']['password_now'];?>" autocomplete="off" required>
  81. </div>
  82. <hr>
  83. <?php
  84. $totp_secret = $tfa->createSecret();
  85. ?>
  86. <input type="hidden" value="<?=$totp_secret;?>" name="totp_secret">
  87. <input type="hidden" name="tfa_method" value="totp">
  88. <ol>
  89. <li>
  90. <p><?=$lang['tfa']['scan_qr_code'];?></p>
  91. <img id="tfa-qr-img" data-totp-secret="<?=$totp_secret;?>" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=">
  92. <p class="help-block"><?=$lang['tfa']['enter_qr_code'];?>:<br />
  93. <code><?=$totp_secret;?></code>
  94. </p>
  95. </li>
  96. <li>
  97. <p><?=$lang['tfa']['confirm_totp_token'];?>:</p>
  98. <p><input type="number" style="width:33%" class="form-control" name="totp_confirm_token" autocomplete="off" required></p>
  99. <p><button class="btn btn-default" type="submit" name="set_tfa"><?=$lang['tfa']['confirm'];?></button></p>
  100. </li>
  101. </ol>
  102. </form>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. <div class="modal fade" id="DisableTFAModal" tabindex="-1" role="dialog" aria-labelledby="DisableTFAModalLabel">
  108. <div class="modal-dialog" role="document">
  109. <div class="modal-content">
  110. <div class="modal-header"><b><?=$lang['tfa']['delete_tfa'];?></b></div>
  111. <div class="modal-body">
  112. <form role="form" method="post">
  113. <div class="input-group">
  114. <input type="password" class="form-control" name="confirm_password" placeholder="<?=$lang['user']['password_now'];?>" autocomplete="off" required>
  115. <span class="input-group-btn">
  116. <input type="hidden" name="tfa_method" value="none">
  117. <button class="btn btn-danger" type="submit" name="set_tfa"><?=$lang['tfa']['delete_tfa'];?></button>
  118. </span>
  119. </div>
  120. </form>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. <?php
  126. endif;
  127. if (isset($_SESSION['pending_tfa_method'])):
  128. $tfa_method = $_SESSION['pending_tfa_method'];
  129. ?>
  130. <div class="modal fade" id="ConfirmTFAModal" tabindex="-1" role="dialog" aria-labelledby="ConfirmTFAModalLabel">
  131. <div class="modal-dialog" role="document">
  132. <div class="modal-content">
  133. <div class="modal-header"><button type="button" class="close" data-dismiss="modal">&times;</button><b><?=$lang['tfa'][$tfa_method];?></b></div>
  134. <div class="modal-body">
  135. <?php
  136. switch ($tfa_method) {
  137. case "yubi_otp":
  138. ?>
  139. <form role="form" method="post">
  140. <div class="form-group">
  141. <div class="input-group">
  142. <span class="input-group-addon" id="yubi-addon"><img alt="Yubicon Icon" src="/img/yubi.ico"></span>
  143. <input type="text" name="token" class="form-control" autocomplete="off" placeholder="Touch Yubikey" aria-describedby="yubi-addon">
  144. <input type="hidden" name="tfa_method" value="yubi_otp">
  145. </div>
  146. </div>
  147. <button class="btn btn-sm btn-default" type="submit" name="verify_tfa_login"><?=$lang['login']['login'];?></button>
  148. </form>
  149. <?php
  150. break;
  151. case "u2f":
  152. ?>
  153. <form role="form" method="post" id="u2f_auth_form">
  154. <center>
  155. <div id="start_u2f_confirmation">
  156. <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24">
  157. <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>
  158. </svg>
  159. <p><?=$lang['tfa']['start_u2f_validation'];?></p>
  160. <hr>
  161. </div>
  162. </center>
  163. <p id="u2f_status_auth"></p>
  164. <div class="alert alert-danger" style="display:none" id="u2f_return_code"></div>
  165. <input type="hidden" name="token" id="u2f_auth_data"/>
  166. <input type="hidden" name="tfa_method" value="u2f">
  167. <input type="hidden" name="verify_tfa_login"/><br/>
  168. </form>
  169. <?php
  170. break;
  171. case "totp":
  172. ?>
  173. <form role="form" method="post">
  174. <div class="form-group">
  175. <div class="input-group">
  176. <span class="input-group-addon" id="tfa-addon"><i class="bi bi-shield-lock-fill"></i></span>
  177. <input type="number" min="000000" max="999999" name="token" class="form-control" placeholder="123456" autocomplete="one-time-code" aria-describedby="tfa-addon">
  178. <input type="hidden" name="tfa_method" value="totp">
  179. </div>
  180. </div>
  181. <button class="btn btn-sm btn-default" type="submit" name="verify_tfa_login"><?=$lang['login']['login'];?></button>
  182. </form>
  183. <?php
  184. break;
  185. case "hotp":
  186. ?>
  187. <div class="empty"></div>
  188. <?php
  189. break;
  190. }
  191. ?>
  192. </div>
  193. </div>
  194. </div>
  195. </div>
  196. <?php
  197. endif;
  198. if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'admin'):
  199. ?>
  200. <div id="RestartContainer" class="modal fade" role="dialog">
  201. <div class="modal-dialog">
  202. <div class="modal-content">
  203. <div class="modal-header">
  204. <button type="button" class="close" data-dismiss="modal">&times;</button>
  205. <h4 class="modal-title"><?= $lang['footer']['restart_container']; ?> (<code id="containerName"></code>)</h4>
  206. </div>
  207. <div class="modal-body">
  208. <p><?= $lang['footer']['restart_container_info']; ?></p>
  209. <hr>
  210. <button class="btn btn-md btn-primary" id="triggerRestartContainer"><?= $lang['footer']['restart_now']; ?></button>
  211. <br><br>
  212. <div id="statusTriggerRestartContainer"></div>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. <?php
  218. endif;
  219. ?>
  220. <div id="ConfirmDeleteModal" class="modal fade" role="dialog">
  221. <div class="modal-dialog">
  222. <div class="modal-content">
  223. <div class="modal-header">
  224. <button type="button" class="close" data-dismiss="modal">&times;</button>
  225. <h4 class="modal-title"><?= $lang['footer']['confirm_delete']; ?></h4>
  226. </div>
  227. <div class="modal-body">
  228. <p id="DeleteText"><?= $lang['footer']['delete_these_items']; ?></p>
  229. <ul id="ItemsToDelete"></ul>
  230. <hr>
  231. <button class="btn btn-sm btn-danger" id="IsConfirmed"><?= $lang['footer']['delete_now']; ?></button>
  232. <button class="btn btn-sm btn-default" id="isCanceled"><?= $lang['footer']['cancel']; ?></button>
  233. </div>
  234. </div>
  235. </div>
  236. </div>