| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <?php
- /* Copyright (C) 2009-2010 Regis Houssin <regis.houssin@inodbox.com>
- * Copyright (C) 2011-2013 Laurent Destailleur <eldy@users.sourceforge.net>
- * Copyright (C) 2021 MB Informatique <info@mb-informatique.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
- if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', 1);
- // Protection to avoid direct call of template
- if (empty($conf) || !is_object($conf)) {
- print "Error, template page can't be called as URL";
- exit;
- }
- require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
- header('Cache-Control: Public, must-revalidate');
- header("Content-type: text/html; charset=" . $conf->file->character_set_client);
- if (GETPOST('dol_hide_topmenu')) $conf->dol_hide_topmenu = 1;
- if (GETPOST('dol_hide_leftmenu')) $conf->dol_hide_leftmenu = 1;
- if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen = 1;
- if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover = 1;
- if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile = 1;
- // If we force to use jmobile, then we reenable javascript
- if (!empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax = 1;
- $php_self = $_SERVER['PHP_SELF'];
- $php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?' . dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '';
- $php_self = str_replace('action=validatenewpassword', '', $php_self);
- $titleofpage = $langs->trans('SendNewPassword');
- print top_htmlhead('', $titleofpage);
- $colorbackhmenu1 = '60,70,100'; // topmenu
- if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
- $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);
- $colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
- ?>
- <!-- BEGIN PHP TEMPLATE PASSWORDFORGOTTEN.TPL.PHP -->
- <body class="body-login authentication-bg" data-layout-config='{"leftSideBarTheme":"dark","layoutBoxed":false, "leftSidebarCondensed":false, "leftSidebarScrollable":false,"darkMode":false, "showRightSidebarOnStart": true}'>
- <?php if (empty($conf->dol_use_jmobile)) { ?>
- <script>
- $(document).ready(function() {
- // Set focus on correct field
- <?php if ($focus_element) { ?>$('#<?php echo $focus_element; ?>').focus();
- <?php } ?> // Warning to use this only on visible element
- });
- </script>
- <?php } ?>
- <div class="account-pages pt-2 pt-sm-5 pb-4 pb-sm-5">
- <div class="container">
- <div class="row justify-content-center">
- <div class="col-xxl-4 col-lg-5">
- <div class="card">
- <form id="login" name="login" method="POST" action="<?php echo $php_self; ?>">
- <input type="hidden" name="token" value="<?php echo newToken(); ?>">
- <input type="hidden" name="action" value="buildnewpassword">
- <!-- Logo -->
- <?php
- if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_squarred_mini)) {
- $urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&modulepart=mycompany&file=' . urlencode('logos/thumbs/' . $mysoc->logo_squarred_mini);
- } else {
- $urllogo = DOL_URL_ROOT . '/custom/themembi/assets/images/logo_white.png';
- }
- ?>
- <div class="card-header pt-4 pb-4 text-center bg-primary">
- <span><img src="<?php echo $urllogo; ?>" alt="" height="32"></span>
- </div>
- <div class="card-body p-4">
- <div class="text-center w-75 m-auto">
- <h4 class="text-dark-50 text-center pb-0 fw-bold"><?php echo $langs->trans('PasswordForgotten'); ?></h4>
- <p class="text-muted mb-4"><?php echo $langs->trans('PasswordForgottenHint'); ?></p>
- </div>
- <!-- Login -->
- <div class="mb-3">
- <label for="username" class="form-label"><?php echo $langs->trans("Login"); ?></label>
- <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" />
- </div>
- <?php
- if ($captcha) {
- // Add a variable param to force not using cache (jmobile)
- $php_self = preg_replace('/[&\?]time=(\d+)/', '', $php_self); // Remove param time
- if (preg_match('/\?/', $php_self)) $php_self .= '&time=' . dol_print_date(dol_now(), 'dayhourlog');
- else $php_self .= '?time=' . dol_print_date(dol_now(), 'dayhourlog');
- // TODO: provide accessible captcha variants
- ?>
- <!-- Captcha -->
- <div class="mb-3">
- <label for="securitycode" class="form-label"><?php echo $langs->trans("SecurityCode"); ?></label><br>
- <div class="d-inline-block">
- <div class="input-group">
- <span class="input-group-text"><i class="uil uil-lock"></i></span>
- <input id="securitycode" placeholder="<?php echo $langs->trans("SecurityCode"); ?>" class="form-control" type="text" maxlength="5" name="code" tabindex="3" />
- </div>
- </div>
- <div class="d-inline-block">
- <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" />
- <a class="inline-block valignmiddle" href="<?php echo $php_self; ?>" tabindex="4"><?php echo $captcha_refresh; ?></a>
- </div>
- </div>
- <?php
- }
- if (!empty($morelogincontent)) {
- if (is_array($morelogincontent)) {
- foreach ($morelogincontent as $format => $option) {
- if ($format == 'table') {
- echo '<!-- Option by hook -->';
- echo $option;
- }
- }
- } else {
- echo '<!-- Option by hook -->';
- echo $morelogincontent;
- }
- }
- ?>
- <div class="mb-0 text-center">
- <input type="submit" <?php echo $disabled; ?> class="btn btn-primary w-100" name="button_password" value="<?php echo $langs->trans('SendNewPassword'); ?>" tabindex="4" />
- </div>
- <?php if ($message) { ?>
- <div class="alert alert-danger w-100 mt-3 mb-0">
- <?php echo strip_tags($message); ?>
- </div>
- <?php } ?>
- </div>
- </form>
- </div><!-- end of card -->
- <?php
- $moreparam = '';
- if (!empty($conf->dol_hide_topmenu)) $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&') . 'dol_hide_topmenu=' . $conf->dol_hide_topmenu;
- if (!empty($conf->dol_hide_leftmenu)) $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&') . 'dol_hide_leftmenu=' . $conf->dol_hide_leftmenu;
- if (!empty($conf->dol_no_mouse_hover)) $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&') . 'dol_no_mouse_hover=' . $conf->dol_no_mouse_hover;
- if (!empty($conf->dol_use_jmobile)) $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&') . 'dol_use_jmobile=' . $conf->dol_use_jmobile;
- print
- '<div class="row mt-3">
- <div class="col-12 text-center">
- <p class="text-muted"><a href="' . $dol_url_root . '/index.php' . $moreparam . '">' . $langs->trans('BackToLoginPage') . '</a></p>
- </div>
- </div>';
- ?>
- </div>
- <!-- Common footer is not used for passwordforgotten page, this is same than footer but inside passwordforgotten tpl -->
- <?php
- if (!empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER;
- if (!empty($morelogincontent) && is_array($morelogincontent)) {
- foreach ($morelogincontent as $format => $option) {
- if ($format == 'js') {
- echo "\n" . '<!-- Javascript by hook -->';
- echo $option . "\n";
- }
- }
- } elseif (!empty($moreloginextracontent)) {
- echo '<!-- Javascript by hook -->';
- echo $moreloginextracontent;
- }
- // Google Analytics
- // TODO Add a hook here
- if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) {
- $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID);
- foreach ($tmptagarray as $tmptag) {
- print "\n";
- print "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
- print "
- <!-- Global site tag (gtag.js) - Google Analytics -->
- <script async src=\"https://www.googletagmanager.com/gtag/js?id=" . trim($tmptag) . "\"></script>
- <script>
- window.dataLayer = window.dataLayer || [];
- function gtag(){dataLayer.push(arguments);}
- gtag('js', new Date());
- gtag('config', '" . trim($tmptag) . "');
- </script>";
- print "\n";
- }
- }
- // TODO Replace this with a hook
- // Google Adsense (need Google module)
- if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) {
- if (empty($conf->dol_use_jmobile)) {
- ?>
- <div class="center"><br>
- <script>
- <!--
- google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
- google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
- google_ad_width = <?php echo $conf->global->MAIN_GOOGLE_AD_WIDTH ?>;
- google_ad_height = <?php echo $conf->global->MAIN_GOOGLE_AD_HEIGHT ?>;
- //
- -->
- </script>
- <script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- </div>
- <?php
- }
- }
- ?>
- </div><!-- end of col -->
- </div><!-- end of row -->
- </div><!-- end of container -->
- </div><!-- end of center -->
- </body>
- </html>
- <!-- END PHP TEMPLATE -->
|