passwordforgotten.tpl.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <?php
  2. /* Copyright (C) 2009-2010 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2011-2013 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2021 MB Informatique <info@mb-informatique.fr>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', 1);
  20. // Protection to avoid direct call of template
  21. if (empty($conf) || !is_object($conf)) {
  22. print "Error, template page can't be called as URL";
  23. exit;
  24. }
  25. require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
  26. header('Cache-Control: Public, must-revalidate');
  27. header("Content-type: text/html; charset=" . $conf->file->character_set_client);
  28. if (GETPOST('dol_hide_topmenu')) $conf->dol_hide_topmenu = 1;
  29. if (GETPOST('dol_hide_leftmenu')) $conf->dol_hide_leftmenu = 1;
  30. if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen = 1;
  31. if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover = 1;
  32. if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile = 1;
  33. // If we force to use jmobile, then we reenable javascript
  34. if (!empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax = 1;
  35. $php_self = $_SERVER['PHP_SELF'];
  36. $php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?' . dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '';
  37. $php_self = str_replace('action=validatenewpassword', '', $php_self);
  38. $titleofpage = $langs->trans('SendNewPassword');
  39. print top_htmlhead('', $titleofpage);
  40. $colorbackhmenu1 = '60,70,100'; // topmenu
  41. if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
  42. $colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1);
  43. $colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
  44. ?>
  45. <!-- BEGIN PHP TEMPLATE PASSWORDFORGOTTEN.TPL.PHP -->
  46. <body class="body-login authentication-bg" data-layout-config='{"leftSideBarTheme":"dark","layoutBoxed":false, "leftSidebarCondensed":false, "leftSidebarScrollable":false,"darkMode":false, "showRightSidebarOnStart": true}'>
  47. <?php if (empty($conf->dol_use_jmobile)) { ?>
  48. <script>
  49. $(document).ready(function() {
  50. // Set focus on correct field
  51. <?php if ($focus_element) { ?>$('#<?php echo $focus_element; ?>').focus();
  52. <?php } ?> // Warning to use this only on visible element
  53. });
  54. </script>
  55. <?php } ?>
  56. <div class="account-pages pt-2 pt-sm-5 pb-4 pb-sm-5">
  57. <div class="container">
  58. <div class="row justify-content-center">
  59. <div class="col-xxl-4 col-lg-5">
  60. <div class="card">
  61. <form id="login" name="login" method="POST" action="<?php echo $php_self; ?>">
  62. <input type="hidden" name="token" value="<?php echo newToken(); ?>">
  63. <input type="hidden" name="action" value="buildnewpassword">
  64. <!-- Logo -->
  65. <?php
  66. if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_squarred_mini)) {
  67. $urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file=' . urlencode('logos/thumbs/' . $mysoc->logo_squarred_mini);
  68. } else {
  69. $urllogo = DOL_URL_ROOT . '/custom/themembi/assets/images/logo_white.png';
  70. }
  71. ?>
  72. <div class="card-header pt-4 pb-4 text-center bg-primary">
  73. <span><img src="<?php echo $urllogo; ?>" alt="" height="32"></span>
  74. </div>
  75. <div class="card-body p-4">
  76. <div class="text-center w-75 m-auto">
  77. <h4 class="text-dark-50 text-center pb-0 fw-bold"><?php echo $langs->trans('PasswordForgotten'); ?></h4>
  78. <p class="text-muted mb-4"><?php echo $langs->trans('PasswordForgottenHint'); ?></p>
  79. </div>
  80. <!-- Login -->
  81. <div class="mb-3">
  82. <label for="username" class="form-label"><?php echo $langs->trans("Login"); ?></label>
  83. <input type="text" placeholder="<?php echo $langs->trans("Login"); ?>" <?php echo $disabled; ?> id="username" name="username" class="form-control" value="<?php echo dol_escape_htmltag($username); ?>" tabindex="1" />
  84. </div>
  85. <?php
  86. if ($captcha) {
  87. // Add a variable param to force not using cache (jmobile)
  88. $php_self = preg_replace('/[&\?]time=(\d+)/', '', $php_self); // Remove param time
  89. if (preg_match('/\?/', $php_self)) $php_self .= '&time=' . dol_print_date(dol_now(), 'dayhourlog');
  90. else $php_self .= '?time=' . dol_print_date(dol_now(), 'dayhourlog');
  91. // TODO: provide accessible captcha variants
  92. ?>
  93. <!-- Captcha -->
  94. <div class="mb-3">
  95. <label for="securitycode" class="form-label"><?php echo $langs->trans("SecurityCode"); ?></label><br>
  96. <div class="d-inline-block">
  97. <div class="input-group">
  98. <span class="input-group-text"><i class="uil uil-lock"></i></span>
  99. <input id="securitycode" placeholder="<?php echo $langs->trans("SecurityCode"); ?>" class="form-control" type="text" maxlength="5" name="code" tabindex="3" />
  100. </div>
  101. </div>
  102. <div class="d-inline-block">
  103. <img class="inline-block valignmiddle" src="<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border="0" width="95" height="37" style="margin-top: -2px; border-radius: 0.25rem;" id="img_securitycode" />
  104. <a class="inline-block valignmiddle" href="<?php echo $php_self; ?>" tabindex="4"><?php echo $captcha_refresh; ?></a>
  105. </div>
  106. </div>
  107. <?php
  108. }
  109. if (!empty($morelogincontent)) {
  110. if (is_array($morelogincontent)) {
  111. foreach ($morelogincontent as $format => $option) {
  112. if ($format == 'table') {
  113. echo '<!-- Option by hook -->';
  114. echo $option;
  115. }
  116. }
  117. } else {
  118. echo '<!-- Option by hook -->';
  119. echo $morelogincontent;
  120. }
  121. }
  122. ?>
  123. <div class="mb-0 text-center">
  124. <input type="submit" <?php echo $disabled; ?> class="btn btn-primary w-100" name="button_password" value="<?php echo $langs->trans('SendNewPassword'); ?>" tabindex="4" />
  125. </div>
  126. <?php if ($message) { ?>
  127. <div class="alert alert-danger w-100 mt-3 mb-0">
  128. <?php echo strip_tags($message); ?>
  129. </div>
  130. <?php } ?>
  131. </div>
  132. </form>
  133. </div><!-- end of card -->
  134. <?php
  135. $moreparam = '';
  136. if (!empty($conf->dol_hide_topmenu)) $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&') . 'dol_hide_topmenu=' . $conf->dol_hide_topmenu;
  137. if (!empty($conf->dol_hide_leftmenu)) $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&') . 'dol_hide_leftmenu=' . $conf->dol_hide_leftmenu;
  138. if (!empty($conf->dol_no_mouse_hover)) $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&') . 'dol_no_mouse_hover=' . $conf->dol_no_mouse_hover;
  139. if (!empty($conf->dol_use_jmobile)) $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&') . 'dol_use_jmobile=' . $conf->dol_use_jmobile;
  140. print
  141. '<div class="row mt-3">
  142. <div class="col-12 text-center">
  143. <p class="text-muted"><a href="' . $dol_url_root . '/index.php' . $moreparam . '">' . $langs->trans('BackToLoginPage') . '</a></p>
  144. </div>
  145. </div>';
  146. ?>
  147. </div>
  148. <!-- Common footer is not used for passwordforgotten page, this is same than footer but inside passwordforgotten tpl -->
  149. <?php
  150. if (!empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER;
  151. if (!empty($morelogincontent) && is_array($morelogincontent)) {
  152. foreach ($morelogincontent as $format => $option) {
  153. if ($format == 'js') {
  154. echo "\n" . '<!-- Javascript by hook -->';
  155. echo $option . "\n";
  156. }
  157. }
  158. } elseif (!empty($moreloginextracontent)) {
  159. echo '<!-- Javascript by hook -->';
  160. echo $moreloginextracontent;
  161. }
  162. // Google Analytics
  163. // TODO Add a hook here
  164. if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) {
  165. $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID);
  166. foreach ($tmptagarray as $tmptag) {
  167. print "\n";
  168. print "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
  169. print "
  170. <!-- Global site tag (gtag.js) - Google Analytics -->
  171. <script async src=\"https://www.googletagmanager.com/gtag/js?id=" . trim($tmptag) . "\"></script>
  172. <script>
  173. window.dataLayer = window.dataLayer || [];
  174. function gtag(){dataLayer.push(arguments);}
  175. gtag('js', new Date());
  176. gtag('config', '" . trim($tmptag) . "');
  177. </script>";
  178. print "\n";
  179. }
  180. }
  181. // TODO Replace this with a hook
  182. // Google Adsense (need Google module)
  183. if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) {
  184. if (empty($conf->dol_use_jmobile)) {
  185. ?>
  186. <div class="center"><br>
  187. <script>
  188. <!--
  189. google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
  190. google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
  191. google_ad_width = <?php echo $conf->global->MAIN_GOOGLE_AD_WIDTH ?>;
  192. google_ad_height = <?php echo $conf->global->MAIN_GOOGLE_AD_HEIGHT ?>;
  193. //
  194. -->
  195. </script>
  196. <script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>
  197. </div>
  198. <?php
  199. }
  200. }
  201. ?>
  202. </div><!-- end of col -->
  203. </div><!-- end of row -->
  204. </div><!-- end of container -->
  205. </div><!-- end of center -->
  206. </body>
  207. </html>
  208. <!-- END PHP TEMPLATE -->