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