From 14af79bd5c510468498390891b3e86b8d173924b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 29 Dec 2009 11:30:41 +0000 Subject: [PATCH] Test: smarty integration --- htdocs/core/templates/login.tpl | 3 +- .../theme/phones/iphone/templates/login.tpl | 2 +- htdocs/user/passwordforgotten.php | 462 +++++++++++------- htdocs/user/templates/index.php | 0 htdocs/user/templates/passwordforgotten.tpl | 151 ++++++ 5 files changed, 448 insertions(+), 170 deletions(-) create mode 100644 htdocs/user/templates/index.php create mode 100644 htdocs/user/templates/passwordforgotten.tpl diff --git a/htdocs/core/templates/login.tpl b/htdocs/core/templates/login.tpl index c2cb03b76a2..cccb767cb83 100644 --- a/htdocs/core/templates/login.tpl +++ b/htdocs/core/templates/login.tpl @@ -64,6 +64,7 @@ function donnefocus() {ldelim}
+ @@ -144,8 +145,6 @@ function donnefocus() {ldelim} - -
{if $smarty.session.dol_loginmesg} diff --git a/htdocs/theme/phones/iphone/templates/login.tpl b/htdocs/theme/phones/iphone/templates/login.tpl index 06f11eaa352..c574f3ae341 100644 --- a/htdocs/theme/phones/iphone/templates/login.tpl +++ b/htdocs/theme/phones/iphone/templates/login.tpl @@ -91,7 +91,7 @@ - + {if $dol_loginmesg} diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index a05e11ac625..1e0996abf9c 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -48,12 +48,15 @@ $langs->load("users"); $langs->load("companies"); $langs->load("ldap"); +if ($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) + accessforbidden(); + $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; $mode=$dolibarr_main_authentication; if (! $mode) $mode='http'; -if ($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) - accessforbidden(); +$login = isset($_POST["username"])?$_POST["username"]:''; +$conf->entity = isset($_POST["entity"])?$_POST["entity"]:1; /** @@ -148,176 +151,301 @@ if ($_POST["action"] == 'buildnewpassword' && $_POST["username"]) /* * Affichage page */ - -$conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; -// Si feuille de style en php existe -if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php"; - -header('Cache-Control: Public, must-revalidate'); - -print ''."\n"; - -// En tete html -print "\n"; -print "\n"; -print ''."\n"; -print ''."\n"; // Evite indexation par robots -print "Dolibarr Authentification\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; - -// Body -print ''."\n"; - -// Form -print '
'."\n"; -print ''; -print ''."\n"; - -// Table 1 -$title='Dolibarr '.DOL_VERSION; -if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE; -print ''."\n"; -if (file_exists(DOL_DOCUMENT_ROOT.'/logo.png')) -{ - print ''."\n"; -} -else -{ - print ''."\n"; -} -print ''."\n"; -print '
'."\n"; - -// Send password button enabled ? -$disabled='disabled'; -if ($mode == 'dolibarr' || $mode == 'dolibarr_mdb2') $disabled=''; -if ($conf->global->MAIN_SECURITY_ENABLE_SENDPASSWORD) $disabled=''; // To force button enabled - -// Table 2 -print ''."\n"; - -print ''."\n"; - -print ''; -print ''; -print ''; - -$title=''; - -// Show logo (search in order: small company logo, large company logo, theme logo, common logo) -$width=0; -$urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; -if (isset($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) -{ - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('/thumbs/'.$mysoc->logo_small); -} -elseif (isset($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) -{ - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode($mysoc->logo); - $width=96; -} -elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_logo.png')) -{ - $urllogo=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_logo.png'; -} -print ''; -print ''."\n"; - - -if (function_exists("imagecreatefrompng") && ! $disabled) -{ - if (! empty($conf->browser->phone)) print ''; // More space with phones - - //print "Info session: ".session_name().session_id();print_r($_SESSION); - print ''; - print ''."\n"; - -print ''."\n"; - -print ""."\n"; - -print ""."\n"; - -print '
'."\n"; -print '
'; -if (($mode == 'dolibarr' || $mode == 'dolibarr_mdb2') || (! $disabled)) -{ - print ''.$langs->trans("SendNewPasswordDesc").''."\n"; -} -else -{ - print '
'.$langs->trans("AuthenticationDoesNotAllowSendNewPassword",$mode).'
'."\n"; -} -print '

'; - -if ($message) -{ - print '
'; - print $message.'

'; -} - -print '
'."\n"; -print ''.$langs->trans("BackToLoginPage").''; -print '
'."\n"; - -print "
"; -print "
"; - - -// Fin entete html -print "\n\n"; ?> diff --git a/htdocs/user/templates/index.php b/htdocs/user/templates/index.php new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/user/templates/passwordforgotten.tpl b/htdocs/user/templates/passwordforgotten.tpl new file mode 100644 index 00000000000..c3c777306b4 --- /dev/null +++ b/htdocs/user/templates/passwordforgotten.tpl @@ -0,0 +1,151 @@ +{* Copyright (C) 2009 Regis Houssin + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + *} +{php} + header('Cache-Control: Public, must-revalidate'); + header("Content-type: text/html; charset=".$conf->file->character_set_client); +{/php} + + + + + + + +Dolibarr Authentification + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + {if $select_entity} + + + {/if} + + {if $captcha} + + + {/if} + + + + + + + +
+ +
+ +
+ + {if ($mode == 'dolibarr' || $mode == 'dolibarr_mdb2') || (! $disabled)} + + {$langs->trans('SendNewPasswordDesc')} + + {else} +
+ {$langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode)} +
+ {/if} + +
+ +
+ + {if $error_message} +
+ {$langs->trans('BackToLoginPage')} + + + +
+
+ + + + + \ No newline at end of file