dolibarr  16.0.5
passwordforgotten.tpl.php
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 
19 
20 if (!defined('NOBROWSERNOTIF')) {
21  define('NOBROWSERNOTIF', 1);
22 }
23 
24 // Protection to avoid direct call of template
25 if (empty($conf) || !is_object($conf)) {
26  print "Error, template page can't be called as URL";
27  exit;
28 }
29 
30 // DDOS protection
31 $size = (int) $_SERVER['CONTENT_LENGTH'];
32 if ($size > 10000) {
33  http_response_code(413);
34  $langs->loadLangs(array("errors", "install"));
35  accessforbidden('<center>'.$langs->trans("ErrorRequestTooLarge").'<br><a href="'.DOL_URL_ROOT.'">'.$langs->trans("ClickHereToGoToApp").'</a></center>', 0, 0, 1);
36  exit;
37 }
38 
39 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
40 
41 header('Cache-Control: Public, must-revalidate');
42 header("Content-type: text/html; charset=".$conf->file->character_set_client);
43 
44 if (GETPOST('dol_hide_topmenu')) {
45  $conf->dol_hide_topmenu = 1;
46 }
47 if (GETPOST('dol_hide_leftmenu')) {
48  $conf->dol_hide_leftmenu = 1;
49 }
50 if (GETPOST('dol_optimize_smallscreen')) {
51  $conf->dol_optimize_smallscreen = 1;
52 }
53 if (GETPOST('dol_no_mouse_hover')) {
54  $conf->dol_no_mouse_hover = 1;
55 }
56 if (GETPOST('dol_use_jmobile')) {
57  $conf->dol_use_jmobile = 1;
58 }
59 
60 // If we force to use jmobile, then we reenable javascript
61 if (!empty($conf->dol_use_jmobile)) {
62  $conf->use_javascript_ajax = 1;
63 }
64 
65 $php_self = $_SERVER['PHP_SELF'];
66 $php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '';
67 $php_self = str_replace('action=validatenewpassword', '', $php_self);
68 
69 $titleofpage = $langs->trans('SendNewPassword');
70 
71 // Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
72 $arrayofjs = array();
73 
74 $disablenofollow = 1;
75 if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) {
76  $disablenofollow = 0;
77 }
78 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
79  $disablenofollow = 0;
80 }
81 
82 print top_htmlhead('', $titleofpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow);
83 
84 
85 $colorbackhmenu1 = '60,70,100'; // topmenu
86 if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) {
87  $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
88 }
89 $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);
90 $colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
91 
92 ?>
93 <!-- BEGIN PHP TEMPLATE PASSWORDFORGOTTEN.TPL.PHP -->
94 
95 <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).'\')"'; ?>>
96 
97 <?php if (empty($conf->dol_use_jmobile)) { ?>
98 <script>
99 $(document).ready(function () {
100  // Set focus on correct field
101  <?php if ($focus_element) {
102  ?>$('#<?php echo $focus_element; ?>').focus(); <?php
103  } ?> // Warning to use this only on visible element
104 });
105 </script>
106 <?php } ?>
107 
108 
109 <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));"' : '' ?>>
110 <div class="login_vertical_align">
111 
112 <form id="login" name="login" method="POST" action="<?php echo $php_self; ?>">
113 <input type="hidden" name="token" value="<?php echo newToken(); ?>">
114 <input type="hidden" name="action" value="buildnewpassword">
115 
116 
117 <!-- Title with version -->
118 <div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
119 <?php
120 if (!empty($disablenofollow)) {
121  echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank" rel="noopener noreferrer external">';
122 }
123 echo dol_escape_htmltag($title);
124 if (!empty($disablenofollow)) {
125  echo '</a>';
126 }
127 ?>
128 </div>
129 
130 
131 
132 <div class="login_table">
133 
134 <div id="login_line1">
135 
136 <div id="login_left">
137 <img alt="" title="" src="<?php echo $urllogo; ?>" id="img_logo" />
138 </div>
139 
140 <br>
141 
142 <div id="login_right">
143 
144 <div class="tagtable centpercent" title="Login pass" >
145 
146 <!-- Login -->
147 <div class="trinputlogin">
148 <div class="tagtd nowraponall center valignmiddle tdinputlogin">
149 <!-- <span class="span-icon-user">-->
150 <span class="fa fa-user"></span>
151 <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" />
152 </div>
153 </div>
154 
155 <?php
156 if (!empty($captcha)) {
157  // Add a variable param to force not using cache (jmobile)
158  $php_self = preg_replace('/[&\?]time=(\d+)/', '', $php_self); // Remove param time
159  if (preg_match('/\?/', $php_self)) {
160  $php_self .= '&time='.dol_print_date(dol_now(), 'dayhourlog');
161  } else {
162  $php_self .= '?time='.dol_print_date(dol_now(), 'dayhourlog');
163  }
164  // TODO: provide accessible captcha variants
165  ?>
166  <!-- Captcha -->
167  <div class="trinputlogin">
168  <div class="tagtd tdinputlogin nowrap none valignmiddle">
169 
170  <span class="fa fa-unlock"></span>
171  <span class="nofa inline-block">
172  <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" />
173  </span>
174  <span class="nowrap inline-block">
175  <img class="inline-block valignmiddle" src="<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />
176  <a class="inline-block valignmiddle" href="<?php echo $php_self; ?>" tabindex="4"><?php echo $captcha_refresh; ?></a>
177  </span>
178 
179  </div></div>
180  <?php
181 }
182 
183 if (!empty($morelogincontent)) {
184  if (is_array($morelogincontent)) {
185  foreach ($morelogincontent as $format => $option) {
186  if ($format == 'table') {
187  echo '<!-- Option by hook -->';
188  echo $option;
189  }
190  }
191  } else {
192  echo '<!-- Option by hook -->';
193  echo $morelogincontent;
194  }
195 }
196 ?>
197 
198 </div>
199 
200 </div> <!-- end div login_right -->
201 
202 </div> <!-- end div login_line1 -->
203 
204 
205 <div id="login_line2" style="clear: both">
206 
207 <!-- Button "Regenerate and Send password" -->
208 <br><input type="submit" <?php echo $disabled; ?> class="button small" name="button_password" value="<?php echo $langs->trans('SendNewPassword'); ?>" tabindex="4" />
209 
210 <br>
211 <div class="center" style="margin-top: 15px;">
212  <?php
213  $moreparam = '';
214  if (!empty($conf->dol_hide_topmenu)) {
215  $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_hide_topmenu='.$conf->dol_hide_topmenu;
216  }
217  if (!empty($conf->dol_hide_leftmenu)) {
218  $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu;
219  }
220  if (!empty($conf->dol_no_mouse_hover)) {
221  $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover;
222  }
223  if (!empty($conf->dol_use_jmobile)) {
224  $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_use_jmobile='.$conf->dol_use_jmobile;
225  }
226 
227  print '<a class="alogin" href="'.$dol_url_root.'/index.php'.$moreparam.'">'.$langs->trans('BackToLoginPage').'</a>';
228  ?>
229 </div>
230 
231 </div>
232 
233 </div>
234 
235 </form>
236 
237 
238 <div class="center login_main_home divpasswordmessagedesc paddingtopbottom<?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent boxshadow'; ?>" style="max-width: 70%">
239 <?php if ($mode == 'dolibarr' || !$disabled) { ?>
240  <span class="passwordmessagedesc">
241  <?php echo $langs->trans('SendNewPasswordDesc'); ?>
242  </span>
243 <?php } else { ?>
244  <div class="warning center">
245  <?php echo $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?>
246  </div>
247 <?php } ?>
248 </div>
249 
250 
251 <br>
252 
253 <?php if (!empty($message)) { ?>
254  <div class="center login_main_message">
255  <?php echo dol_htmloutput_mesg($message, '', '', 1); ?>
256  </div>
257 <?php } ?>
258 
259 
260 <!-- Common footer is not used for passwordforgotten page, this is same than footer but inside passwordforgotten tpl -->
261 
262 <?php
263 if (!empty($conf->global->MAIN_HTML_FOOTER)) {
264  print $conf->global->MAIN_HTML_FOOTER;
265 }
266 
267 if (!empty($morelogincontent) && is_array($morelogincontent)) {
268  foreach ($morelogincontent as $format => $option) {
269  if ($format == 'js') {
270  echo "\n".'<!-- Javascript by hook -->';
271  echo $option."\n";
272  }
273  }
274 } elseif (!empty($moreloginextracontent)) {
275  echo '<!-- Javascript by hook -->';
276  echo $moreloginextracontent;
277 }
278 
279 // Google Analytics
280 // TODO Add a hook here
281 if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) {
282  $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID);
283  foreach ($tmptagarray as $tmptag) {
284  print "\n";
285  print "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
286  print "
287  <!-- Global site tag (gtag.js) - Google Analytics -->
288  <script async src=\"https://www.googletagmanager.com/gtag/js?id=".trim($tmptag)."\"></script>
289  <script>
290  window.dataLayer = window.dataLayer || [];
291  function gtag(){dataLayer.push(arguments);}
292  gtag('js', new Date());
293 
294  gtag('config', '".trim($tmptag)."');
295  </script>";
296  print "\n";
297  }
298 }
299 
300 // TODO Replace this with a hook
301 // Google Adsense (need Google module)
302 if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) {
303  if (empty($conf->dol_use_jmobile)) {
304  ?>
305  <div class="center"><br>
306  <script><!--
307  google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
308  google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
309  google_ad_width = <?php echo $conf->global->MAIN_GOOGLE_AD_WIDTH ?>;
310  google_ad_height = <?php echo $conf->global->MAIN_GOOGLE_AD_HEIGHT ?>;
311  //-->
312  </script>
313  <script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>
314  </div>
315  <?php
316  }
317 }
318 ?>
319 
320 
321 </div>
322 </div> <!-- end of center -->
323 
324 
325 </body>
326 </html>
327 <!-- END PHP TEMPLATE -->
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1468
colorStringToArray
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,...
Definition: functions2.lib.php:2402
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
top_htmlhead
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
Definition: main.inc.php:1482
name
$conf db name
Definition: repair.php:122
Login
API that allows to log in with an user account.
Definition: api_login.class.php:26
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10878
dol_htmloutput_mesg
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
Definition: functions.lib.php:8299
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
type
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:119