* * 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$ * $Source$ */ /** \file htdocs/user/fiche.php \brief Onglet user et permissions de la fiche utilisateur \version $Revision$ */ require("../master.inc.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php"); $user->getrights('user'); $langs->load("main"); $langs->load("other"); $langs->load("users"); $langs->load("companies"); $langs->load("ldap"); $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; $mode=$dolibarr_main_authentication; if (! $mode) $mode='http'; /** * Actions */ // Action modif mot de passe if ($_GET["action"] == 'validatenewpassword' && $_GET["username"] && $_GET["passwordmd5"]) { $edituser = new User($db); $result=$edituser->fetch($_GET["username"]); if ($result < 0) { $message = '
'.$langs->trans("ErrorLoginDoesNotExists",$_GET["username"]).'
'; } else { if (md5($edituser->pass_temp) == $_GET["passwordmd5"]) { $newpassword=$edituser->password($user,$edituser->pass_temp,$conf->password_encrypted,0); dolibarr_syslog("passwordforgotten.php new password saved in database"); //session_start(); //$_SESSION["loginmesg"]=$langs->trans("PasswordChanged"); header("Location: ".DOL_URL_ROOT.'/'); exit; } else { $message = '
'.$langs->trans("ErrorFailedToValidatePassword").'
'; } } } // Action modif mot de passe if ($_POST["action"] == 'buildnewpassword' && $_POST["username"]) { $edituser = new User($db); $result=$edituser->fetch($_POST["username"]); if ($result < 0) { $message = '
'.$langs->trans("ErrorLoginDoesNotExists",$_POST["username"]).'
'; } else { if (! $edituser->email) { $message = '
'.$langs->trans("ErrorLoginHasNoEmail").'
'; } else { $newpassword=$edituser->password($user,'',$conf->password_encrypted,1); if ($newpassword < 0) { // Echec $message = '
'.$langs->trans("ErrorFailedToChangePassword").'
'; } else { // Succes if ($edituser->send_password($user,$newpassword,1) > 0) { $message = '
'.$langs->trans("PasswordChangedAndSentTo",$edituser->email).'
'; //$message.=$newpassword; } else { //$message = '
'.$langs->trans("PasswordChangedTo",$newpassword).'
'; $message.= '
'.$edituser->error.'
'; } } } } } /* * 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"; print ''."\n"; // En tete html 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 ''."\n"; // Table 1 print ''."\n"; if (file_exists(DOL_DOCUMENT_ROOT.'/logo.png')) { print ''."\n"; } else { print ''."\n"; } print '
'; print '
Dolibarr '.DOL_VERSION.'
'."\n"; print '
'."\n"; // Table 2 print ''."\n"; print ''."\n"; print ''; $disabled='disabled'; if ($mode == 'dolibarr') $disabled=''; print ''; $title=''; // Affiche logo du theme si existe, sinon logo commun $urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; if (is_readable($conf->societe->dir_logos.'/'.$mysoc->logo)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode($mysoc->logo); $height=100; // \TODO Forcer la hauteur uniquement si hauteur > 100 ou largeur > 100 } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_logo.png')) { $urllogo=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_logo.png'; $height=80; } print ''; print ''."\n"; print "".''."\n"; print "
 
  '.$langs->trans("Login").'  
"."\n"; print "
"."\n"; print '
'."\n"; if ($mode == 'dolibarr') { print '
'.$langs->trans("SendNewPasswordDesc").'

'."\n"; } else { print '
'.$langs->trans("AuthenticationDoesNotAllowSendNewPassword",$mode).'
'."\n"; } print '
'."\n"; if ($message) { print $message.'
'; } print ''.$langs->trans("BackToLoginPage").''; print '
'."\n"; print "
"; print "
"; // Fin entete html print "\n\n"; ?>