passwordforgotten.tpl.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. if (!defined('NOBROWSERNOTIF')) {
  19. define('NOBROWSERNOTIF', 1);
  20. }
  21. // Protection to avoid direct call of template
  22. if (empty($conf) || !is_object($conf)) {
  23. print "Error, template page can't be called as URL";
  24. exit;
  25. }
  26. // DDOS protection
  27. $size = (int) $_SERVER['CONTENT_LENGTH'];
  28. if ($size > 10000) {
  29. http_response_code(413);
  30. exit;
  31. }
  32. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  33. header('Cache-Control: Public, must-revalidate');
  34. header("Content-type: text/html; charset=".$conf->file->character_set_client);
  35. if (GETPOST('dol_hide_topmenu')) {
  36. $conf->dol_hide_topmenu = 1;
  37. }
  38. if (GETPOST('dol_hide_leftmenu')) {
  39. $conf->dol_hide_leftmenu = 1;
  40. }
  41. if (GETPOST('dol_optimize_smallscreen')) {
  42. $conf->dol_optimize_smallscreen = 1;
  43. }
  44. if (GETPOST('dol_no_mouse_hover')) {
  45. $conf->dol_no_mouse_hover = 1;
  46. }
  47. if (GETPOST('dol_use_jmobile')) {
  48. $conf->dol_use_jmobile = 1;
  49. }
  50. // If we force to use jmobile, then we reenable javascript
  51. if (!empty($conf->dol_use_jmobile)) {
  52. $conf->use_javascript_ajax = 1;
  53. }
  54. $php_self = $_SERVER['PHP_SELF'];
  55. $php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '';
  56. $php_self = str_replace('action=validatenewpassword', '', $php_self);
  57. $titleofpage = $langs->trans('SendNewPassword');
  58. // Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
  59. $arrayofjs = array();
  60. $disablenofollow = 1;
  61. if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) {
  62. $disablenofollow = 0;
  63. }
  64. if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
  65. $disablenofollow = 0;
  66. }
  67. print top_htmlhead('', $titleofpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow);
  68. $colorbackhmenu1 = '60,70,100'; // topmenu
  69. if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) {
  70. $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
  71. }
  72. $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);
  73. $colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
  74. ?>
  75. <!-- BEGIN PHP TEMPLATE PASSWORDFORGOTTEN.TPL.PHP -->
  76. <body class="body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>>
  77. <?php if (empty($conf->dol_use_jmobile)) { ?>
  78. <script>
  79. $(document).ready(function () {
  80. // Set focus on correct field
  81. <?php if ($focus_element) {
  82. ?>$('#<?php echo $focus_element; ?>').focus(); <?php
  83. } ?> // Warning to use this only on visible element
  84. });
  85. </script>
  86. <?php } ?>
  87. <div class="login_center center"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));"' : '' ?>>
  88. <div class="login_vertical_align">
  89. <form id="login" name="login" method="POST" action="<?php echo $php_self; ?>">
  90. <input type="hidden" name="token" value="<?php echo newToken(); ?>">
  91. <input type="hidden" name="action" value="buildnewpassword">
  92. <!-- Title with version -->
  93. <div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
  94. <?php
  95. if (!empty($disablenofollow)) {
  96. echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank" rel="noopener noreferrer external">';
  97. }
  98. echo dol_escape_htmltag($title);
  99. if (!empty($disablenofollow)) {
  100. echo '</a>';
  101. }
  102. ?>
  103. </div>
  104. <div class="login_table">
  105. <div id="login_line1">
  106. <div id="login_left">
  107. <img alt="" title="" src="<?php echo $urllogo; ?>" id="img_logo" />
  108. </div>
  109. <br>
  110. <div id="login_right">
  111. <div class="tagtable centpercent" title="Login pass" >
  112. <!-- Login -->
  113. <div class="trinputlogin">
  114. <div class="tagtd nowraponall center valignmiddle tdinputlogin">
  115. <!-- <span class="span-icon-user">-->
  116. <span class="fa fa-user"></span>
  117. <input type="text" maxlength="255" placeholder="<?php echo $langs->trans("Login"); ?>" <?php echo $disabled; ?> id="username" name="username" class="flat input-icon-user minwidth150" value="<?php echo dol_escape_htmltag($username); ?>" tabindex="1" />
  118. </div>
  119. </div>
  120. <?php
  121. if (!empty($captcha)) {
  122. // Add a variable param to force not using cache (jmobile)
  123. $php_self = preg_replace('/[&\?]time=(\d+)/', '', $php_self); // Remove param time
  124. if (preg_match('/\?/', $php_self)) {
  125. $php_self .= '&time='.dol_print_date(dol_now(), 'dayhourlog');
  126. } else {
  127. $php_self .= '?time='.dol_print_date(dol_now(), 'dayhourlog');
  128. }
  129. // TODO: provide accessible captcha variants
  130. ?>
  131. <!-- Captcha -->
  132. <div class="trinputlogin">
  133. <div class="tagtd tdinputlogin nowrap none valignmiddle">
  134. <span class="fa fa-unlock"></span>
  135. <span class="nofa inline-block">
  136. <input id="securitycode" placeholder="<?php echo $langs->trans("SecurityCode"); ?>" class="flat input-icon-security width125" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" />
  137. </span>
  138. <span class="nowrap inline-block">
  139. <img class="inline-block valignmiddle" src="<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />
  140. <a class="inline-block valignmiddle" href="<?php echo $php_self; ?>" tabindex="4"><?php echo $captcha_refresh; ?></a>
  141. </span>
  142. </div></div>
  143. <?php
  144. }
  145. if (!empty($morelogincontent)) {
  146. if (is_array($morelogincontent)) {
  147. foreach ($morelogincontent as $format => $option) {
  148. if ($format == 'table') {
  149. echo '<!-- Option by hook -->';
  150. echo $option;
  151. }
  152. }
  153. } else {
  154. echo '<!-- Option by hook -->';
  155. echo $morelogincontent;
  156. }
  157. }
  158. ?>
  159. </div>
  160. </div> <!-- end div login_right -->
  161. </div> <!-- end div login_line1 -->
  162. <div id="login_line2" style="clear: both">
  163. <!-- Button "Regenerate and Send password" -->
  164. <br><input type="submit" <?php echo $disabled; ?> class="button small" name="button_password" value="<?php echo $langs->trans('SendNewPassword'); ?>" tabindex="4" />
  165. <br>
  166. <div class="center" style="margin-top: 15px;">
  167. <?php
  168. $moreparam = '';
  169. if (!empty($conf->dol_hide_topmenu)) {
  170. $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_hide_topmenu='.$conf->dol_hide_topmenu;
  171. }
  172. if (!empty($conf->dol_hide_leftmenu)) {
  173. $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu;
  174. }
  175. if (!empty($conf->dol_no_mouse_hover)) {
  176. $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover;
  177. }
  178. if (!empty($conf->dol_use_jmobile)) {
  179. $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_use_jmobile='.$conf->dol_use_jmobile;
  180. }
  181. print '<a class="alogin" href="'.$dol_url_root.'/index.php'.$moreparam.'">'.$langs->trans('BackToLoginPage').'</a>';
  182. ?>
  183. </div>
  184. </div>
  185. </div>
  186. </form>
  187. <div class="center login_main_home divpasswordmessagedesc paddingtopbottom<?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent boxshadow'; ?>" style="max-width: 70%">
  188. <?php if ($mode == 'dolibarr' || !$disabled) { ?>
  189. <span class="passwordmessagedesc">
  190. <?php echo $langs->trans('SendNewPasswordDesc'); ?>
  191. </span>
  192. <?php } else { ?>
  193. <div class="warning center">
  194. <?php echo $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?>
  195. </div>
  196. <?php } ?>
  197. </div>
  198. <br>
  199. <?php if (!empty($message)) { ?>
  200. <div class="center login_main_message">
  201. <?php echo dol_htmloutput_mesg($message, '', '', 1); ?>
  202. </div>
  203. <?php } ?>
  204. <!-- Common footer is not used for passwordforgotten page, this is same than footer but inside passwordforgotten tpl -->
  205. <?php
  206. if (!empty($conf->global->MAIN_HTML_FOOTER)) {
  207. print $conf->global->MAIN_HTML_FOOTER;
  208. }
  209. if (!empty($morelogincontent) && is_array($morelogincontent)) {
  210. foreach ($morelogincontent as $format => $option) {
  211. if ($format == 'js') {
  212. echo "\n".'<!-- Javascript by hook -->';
  213. echo $option."\n";
  214. }
  215. }
  216. } elseif (!empty($moreloginextracontent)) {
  217. echo '<!-- Javascript by hook -->';
  218. echo $moreloginextracontent;
  219. }
  220. // Google Analytics
  221. // TODO Add a hook here
  222. if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) {
  223. $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID);
  224. foreach ($tmptagarray as $tmptag) {
  225. print "\n";
  226. print "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
  227. print "
  228. <!-- Global site tag (gtag.js) - Google Analytics -->
  229. <script async src=\"https://www.googletagmanager.com/gtag/js?id=".trim($tmptag)."\"></script>
  230. <script>
  231. window.dataLayer = window.dataLayer || [];
  232. function gtag(){dataLayer.push(arguments);}
  233. gtag('js', new Date());
  234. gtag('config', '".trim($tmptag)."');
  235. </script>";
  236. print "\n";
  237. }
  238. }
  239. // TODO Replace this with a hook
  240. // Google Adsense (need Google module)
  241. if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) {
  242. if (empty($conf->dol_use_jmobile)) {
  243. ?>
  244. <div class="center"><br>
  245. <script><!--
  246. google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
  247. google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
  248. google_ad_width = <?php echo $conf->global->MAIN_GOOGLE_AD_WIDTH ?>;
  249. google_ad_height = <?php echo $conf->global->MAIN_GOOGLE_AD_HEIGHT ?>;
  250. //-->
  251. </script>
  252. <script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>
  253. </div>
  254. <?php
  255. }
  256. }
  257. ?>
  258. </div>
  259. </div> <!-- end of center -->
  260. </body>
  261. </html>
  262. <!-- END PHP TEMPLATE -->