* * 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 ''; // Form print '
'; print ''; // Table 1 print ''; if (file_exists(DOL_DOCUMENT_ROOT.'/logo.png')) { print ''; } else { print ''; } print '
'; print '
Dolibarr '.DOL_VERSION.'
'; print '
'; // Table 2 print ''; print ''; print ''; $disabled='disabled'; if ($mode == 'dolibarr') $disabled=''; print ''; // Affiche logo du theme si existe, sinon logo commun if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_logo.png')) { print ''; } else { print ''; } print ''; print "".''; print "
 
  '.$langs->trans("Login").'  
\n"; print "
"; print '
'; if ($mode == 'dolibarr') { print $langs->trans("SendNewPasswordDesc").'
'; } else { print '
'.$langs->trans("AuthenticationDoesNotAllowSendNewPassword",$mode).'
'; } print '
'; if ($message) { print $message.'
'; } print ''.$langs->trans("BackToLoginPage").''; print '
'; print "
"; print "
"; // Fin entete html print "\n\n"; ?>