Ajout message erreur connection
This commit is contained in:
parent
fd5ccdd76a
commit
cf546acabb
@ -8,6 +8,8 @@ ErrorRecordAlreadyExists=Record already exists
|
|||||||
ErrorCantReadFile=Failed to read file '%s'
|
ErrorCantReadFile=Failed to read file '%s'
|
||||||
ErrorCantReadDir=Failed to read directory '%s'
|
ErrorCantReadDir=Failed to read directory '%s'
|
||||||
ErrorFailedToFindEntity=Failed to read entity '%s'
|
ErrorFailedToFindEntity=Failed to read entity '%s'
|
||||||
|
ErrorBadLoginPassword=Bad value for login or password
|
||||||
|
ErrorLoginDisabled=Your account has been disabled
|
||||||
Calendar=Calendar
|
Calendar=Calendar
|
||||||
AddTrip=Add trip
|
AddTrip=Add trip
|
||||||
Tools=Tools
|
Tools=Tools
|
||||||
|
|||||||
@ -8,6 +8,8 @@ ErrorRecordAlreadyExists=Enregistrement d
|
|||||||
ErrorCantReadFile=Echec de lecture du fichier '%s'
|
ErrorCantReadFile=Echec de lecture du fichier '%s'
|
||||||
ErrorCantReadDir=Echec de lecture du répertoire '%s'
|
ErrorCantReadDir=Echec de lecture du répertoire '%s'
|
||||||
ErrorFailedToFindEntity=Echec de lecture de l'entité '%s'
|
ErrorFailedToFindEntity=Echec de lecture de l'entité '%s'
|
||||||
|
ErrorBadLoginPassword=Identifiants login ou mot de passe incorrects
|
||||||
|
ErrorLoginDisabled=Votre compte est désactivé
|
||||||
Calendar=Calendrier
|
Calendar=Calendrier
|
||||||
AddTrip=Créer déplacement
|
AddTrip=Créer déplacement
|
||||||
Tools=Outils
|
Tools=Outils
|
||||||
|
|||||||
@ -986,13 +986,14 @@ function info_admin($texte)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Affiche formulaire de login
|
\brief Affiche formulaire de login PEAR
|
||||||
\remarks il faut changer le code html dans cette fonction pour changer le design
|
\remarks Il faut changer le code html dans cette fonction pour changer le design
|
||||||
*/
|
*/
|
||||||
function loginfunction()
|
function dol_loginfunction($notused,$pearstatus)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
$langs->load("main");
|
$langs->load("main");
|
||||||
|
$langs->load("other");
|
||||||
|
|
||||||
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
|
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
|
||||||
// Si feuille de style en php existe
|
// Si feuille de style en php existe
|
||||||
@ -1013,7 +1014,7 @@ function loginfunction()
|
|||||||
print '<!--'."\n";
|
print '<!--'."\n";
|
||||||
print '#login {';
|
print '#login {';
|
||||||
print ' margin-top: 70px;';
|
print ' margin-top: 70px;';
|
||||||
print ' margin-bottom: 50px;';
|
print ' margin-bottom: 30px;';
|
||||||
print ' text-align: center;';
|
print ' text-align: center;';
|
||||||
print ' font: 12px arial,helvetica;';
|
print ' font: 12px arial,helvetica;';
|
||||||
print '}'."\n";
|
print '}'."\n";
|
||||||
@ -1037,6 +1038,7 @@ function loginfunction()
|
|||||||
print "}\n";
|
print "}\n";
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
print '</head>'."\n";
|
print '</head>'."\n";
|
||||||
|
|
||||||
print '<body class="body" onload="donnefocus();">';
|
print '<body class="body" onload="donnefocus();">';
|
||||||
|
|
||||||
print '<form id="login" name="login" method="post" action="';
|
print '<form id="login" name="login" method="post" action="';
|
||||||
@ -1097,20 +1099,40 @@ function loginfunction()
|
|||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
// Message
|
||||||
|
if ($_SESSION["loginmesg"] || ! empty($pearstatus))
|
||||||
|
{
|
||||||
|
print '<center><table width="60%"><tr><td align="center" class="small"><div class="error">';
|
||||||
|
if ($pearstatus == AUTH_EXPIRED) print "<i>Your session expired. Please login again!</i>\n";
|
||||||
|
elseif ($pearstatus == AUTH_IDLED) print "<i>You have been idle for too long. Please login again!</i>\n";
|
||||||
|
elseif ($pearstatus == AUTH_WRONG_LOGIN) print $langs->trans("ErrorBadLoginPassword");
|
||||||
|
elseif ($_SESSION["loginmesg"])
|
||||||
|
{
|
||||||
|
print $_SESSION["loginmesg"];
|
||||||
|
$_SESSION["loginmesg"]="";
|
||||||
|
}
|
||||||
|
print '</div></td></tr></table></center>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n</body>\n</html>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Affiche message erreur de type acces interdit et arrete le programme
|
\brief Affiche message erreur de type acces interdit et arrete le programme
|
||||||
|
\param message Force error message
|
||||||
\remarks L'appel a cette fonction termine le code.
|
\remarks L'appel a cette fonction termine le code.
|
||||||
*/
|
*/
|
||||||
function accessforbidden()
|
function accessforbidden($message='')
|
||||||
{
|
{
|
||||||
global $user, $langs;
|
global $user, $langs;
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
print '<div class="error">'.$langs->trans("ErrorForbidden").'</div>';
|
print '<div class="error">';
|
||||||
|
if (! $message) print $langs->trans("ErrorForbidden");
|
||||||
|
else print $message;
|
||||||
|
print '</div>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
if ($user->login)
|
if ($user->login)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -45,9 +45,9 @@ function stripslashes_deep($value)
|
|||||||
}
|
}
|
||||||
if (get_magic_quotes_gpc())
|
if (get_magic_quotes_gpc())
|
||||||
{
|
{
|
||||||
$_GET = array_map('stripslashes_deep', $_GET);
|
$_GET = array_map('stripslashes_deep', $_GET);
|
||||||
$_POST = array_map('stripslashes_deep', $_POST);
|
$_POST = array_map('stripslashes_deep', $_POST);
|
||||||
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
|
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
|
||||||
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
|
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ if (! session_id() && ! isset($_SESSION["dol_user"]) && ! isset($_SESSION["dol_
|
|||||||
"cryptType" => "none",
|
"cryptType" => "none",
|
||||||
);
|
);
|
||||||
|
|
||||||
$aDol = new DOLIAuth("DB", $params, "loginfunction");
|
$aDol = new DOLIAuth("DB", $params, "dol_loginfunction");
|
||||||
$aDol->setSessionName("DOLSESSID_".$dolibarr_main_db_name);
|
$aDol->setSessionName("DOLSESSID_".$dolibarr_main_db_name);
|
||||||
$aDol->start();
|
$aDol->start();
|
||||||
$result = $aDol->getAuth(); // Si deja logue avec succes, renvoie vrai, sinon effectue un redirect sur page loginfunction et renvoie false
|
$result = $aDol->getAuth(); // Si deja logue avec succes, renvoie vrai, sinon effectue un redirect sur page loginfunction et renvoie false
|
||||||
@ -136,70 +136,61 @@ if (! session_id() && ! isset($_SESSION["dol_user"]) && ! isset($_SESSION["dol_
|
|||||||
// Non authentifie
|
// Non authentifie
|
||||||
//dolibarr_syslog("Authentification non realise");
|
//dolibarr_syslog("Authentification non realise");
|
||||||
}
|
}
|
||||||
// Le debut de la page a ete affichee par getAuth qui a utilisé loginfunction.
|
|
||||||
// On ferme donc juste la page de logon.
|
|
||||||
print "\n</body>\n</html>";
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MODE LDAP
|
// MODE LDAP
|
||||||
if (in_array('ldap',$authmode) && ! $login)
|
if ($conf->ldap->enabled && in_array('ldap',$authmode) && ! $login)
|
||||||
{
|
{
|
||||||
if ($conf->ldap->enabled)
|
// Authentification Apache KO ou non active, pas de mode force on demande le login
|
||||||
{
|
require_once(DOL_DOCUMENT_ROOT."/includes/pear/Auth/Auth.php");
|
||||||
// Authentification Apache KO ou non active, pas de mode force on demande le login
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/includes/pear/Auth/Auth.php");
|
|
||||||
|
|
||||||
//if ($conf->global->LDAP_SERVER_PROTOCOLVERSION == 3)
|
//if ($conf->global->LDAP_SERVER_PROTOCOLVERSION == 3)
|
||||||
//{
|
//{
|
||||||
$ldap = 'ldap://'.$conf->global->LDAP_ADMIN_DN.':'.$conf->global->LDAP_ADMIN_PASS.'@'.$conf->global->LDAP_SERVER_HOST.':'.$conf->global->LDAP_SERVER_PORT.'/'.$conf->global->LDAP_SERVER_DN;
|
$ldap = 'ldap://'.$conf->global->LDAP_ADMIN_DN.':'.$conf->global->LDAP_ADMIN_PASS.'@'.$conf->global->LDAP_SERVER_HOST.':'.$conf->global->LDAP_SERVER_PORT.'/'.$conf->global->LDAP_SERVER_DN;
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
// $ldap = 'ldap2://'.$conf->global->LDAP_ADMIN_DN.':'.$conf->global->LDAP_ADMIN_PASS.'@'.$conf->global->LDAP_SERVER_HOST.':'.$conf->global->LDAP_SERVER_PORT.'/'.$conf->global->LDAP_SERVER_DN;
|
// $ldap = 'ldap2://'.$conf->global->LDAP_ADMIN_DN.':'.$conf->global->LDAP_ADMIN_PASS.'@'.$conf->global->LDAP_SERVER_HOST.':'.$conf->global->LDAP_SERVER_PORT.'/'.$conf->global->LDAP_SERVER_DN;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'dsn' => $ldap,
|
'dsn' => $ldap,
|
||||||
'host' => $conf->global->LDAP_SERVER_HOST,
|
'host' => $conf->global->LDAP_SERVER_HOST,
|
||||||
'port' => $conf->global->LDAP_SERVER_PORT,
|
'port' => $conf->global->LDAP_SERVER_PORT,
|
||||||
'version' => $conf->global->LDAP_SERVER_PORT,
|
'version' => $conf->global->LDAP_SERVER_PORT,
|
||||||
'basedn' => $conf->global->LDAP_SERVER_DN,
|
'basedn' => $conf->global->LDAP_SERVER_DN,
|
||||||
'binddn' => $conf->global->LDAP_ADMIN_DN,
|
'binddn' => $conf->global->LDAP_ADMIN_DN,
|
||||||
'bindpw' => $conf->global->LDAP_ADMIN_PASS,
|
'bindpw' => $conf->global->LDAP_ADMIN_PASS,
|
||||||
//'userattr' => $conf->global->LDAP_FIELD_LOGIN_SAMBA,
|
//'userattr' => $conf->global->LDAP_FIELD_LOGIN_SAMBA,
|
||||||
'userattr' => 'samAccountName',
|
'userattr' => 'samAccountName',
|
||||||
'userfilter' => '(objectClass=user)',
|
'userfilter' => '(objectClass=user)',
|
||||||
);
|
);
|
||||||
|
|
||||||
$aDol = new DOLIAuth("LDAP", $params, "loginfunction");
|
$aDol = new DOLIAuth("LDAP", $params, "dol_loginfunction");
|
||||||
$aDol->start();
|
$aDol->start();
|
||||||
$result = $aDol->getAuth(); // Si deja logue avec succes, renvoie vrai, sinon effectue un redirect sur page loginfunction et renvoie false
|
$result = $aDol->getAuth(); // Si deja logue avec succes, renvoie vrai, sinon effectue un redirect sur page loginfunction et renvoie false
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
// Authentification Auth OK, on va chercher le login
|
// Authentification Auth OK, on va chercher le login
|
||||||
$login=$aDol->getUsername();
|
$login=$aDol->getUsername();
|
||||||
dolibarr_syslog ("Authentification ok (en mode Pear Base LDAP)");
|
dolibarr_syslog ("Authentification ok (en mode Pear Base LDAP)");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isset($_POST["loginfunction"]))
|
if (isset($_POST["loginfunction"]))
|
||||||
{
|
{
|
||||||
// Echec authentification
|
// Echec authentification
|
||||||
dolibarr_syslog("Authentification ko (en mode Pear Base LDAP) pour '".$_POST["username"]."'");
|
dolibarr_syslog("Authentification ko (en mode Pear Base LDAP) pour '".$_POST["username"]."'");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Non authentifie
|
// Non authentifie
|
||||||
//dolibarr_syslog("Authentification non realise");
|
//dolibarr_syslog("Authentification non realise");
|
||||||
}
|
}
|
||||||
// Le debut de la page a ete affichee par getAuth qui a utilisé loginfunction.
|
exit;
|
||||||
// On ferme donc juste la page de logon.
|
}
|
||||||
print "</div>\n</div>\n</body>\n</html>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -208,10 +199,9 @@ else
|
|||||||
$login=$_SESSION["dol_user"];
|
$login=$_SESSION["dol_user"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Charge l'objet user depuis son login
|
// Charge l'objet user depuis son login
|
||||||
$user->fetch($login);
|
$result=$user->fetch($login);
|
||||||
if (! $user->id)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dolibarr_print_error($langs->trans("ErrorCantLoadUserFromDolibarrDatabase"));
|
dolibarr_print_error($langs->trans("ErrorCantLoadUserFromDolibarrDatabase"));
|
||||||
exit;
|
exit;
|
||||||
@ -292,6 +282,17 @@ else // Si utilisateur externe
|
|||||||
// Tentative de hacking ?
|
// Tentative de hacking ?
|
||||||
if (! $user->login) accessforbidden();
|
if (! $user->login) accessforbidden();
|
||||||
|
|
||||||
|
// Verifie si user actif
|
||||||
|
if ($user->statut < 1)
|
||||||
|
{
|
||||||
|
// Si non actif, on delogue le user
|
||||||
|
$langs->load("other");
|
||||||
|
dolibarr_syslog ("Authentification ko (en mode Pear Base Dolibarr) car login desactive");
|
||||||
|
accessforbidden($langs->trans("ErrorLoginDisabled"));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dolibarr_syslog("Access to ".$_SERVER["PHP_SELF"]);
|
dolibarr_syslog("Access to ".$_SERVER["PHP_SELF"]);
|
||||||
|
|
||||||
@ -351,6 +352,8 @@ function top_htmlhead($head, $title="", $target="")
|
|||||||
{
|
{
|
||||||
global $user, $conf, $langs, $db;
|
global $user, $conf, $langs, $db;
|
||||||
|
|
||||||
|
if (! $conf->css) $conf->css ='/theme/eldy/eldy.css.php';
|
||||||
|
|
||||||
//header("Content-type: text/html; charset=UTF-8");
|
//header("Content-type: text/html; charset=UTF-8");
|
||||||
header("Content-type: text/html; charset=iso-8859-1");
|
header("Content-type: text/html; charset=iso-8859-1");
|
||||||
|
|
||||||
@ -419,6 +422,9 @@ function top_menu($head, $title="", $target="")
|
|||||||
{
|
{
|
||||||
global $user, $conf, $langs, $db;
|
global $user, $conf, $langs, $db;
|
||||||
|
|
||||||
|
if (! $conf->top_menu) $conf->top_menu ='eldy_backoffice.php';
|
||||||
|
if (! $conf->left_menu) $conf->left_menu='eldy_backoffice.php';
|
||||||
|
|
||||||
top_htmlhead($head, $title, $target);
|
top_htmlhead($head, $title, $target);
|
||||||
|
|
||||||
print '<body id="mainbody"><div id="dhtmltooltip"></div>';
|
print '<body id="mainbody"><div id="dhtmltooltip"></div>';
|
||||||
|
|||||||
@ -503,16 +503,18 @@ class User
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Désactive un utilisateur
|
* \brief Change statut d'un utilisateur
|
||||||
* \return int <0 si ko, >0 si ok
|
* \return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
function disable()
|
function setstatus($statut)
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
// Désactive utilisateur
|
// Désactive utilisateur
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||||
$sql.= " SET login = NULL";
|
$sql.= " SET statut = ".$statut;
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
@ -528,10 +530,12 @@ class User
|
|||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
return -$error;
|
return -$error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1116,6 +1120,61 @@ class User
|
|||||||
$result.=$lien.$this->login.$lienfin;
|
$result.=$lien.$this->login.$lienfin;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Retourne le libellé du statut d'un user (actif, inactif)
|
||||||
|
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long
|
||||||
|
* \return string Libelle
|
||||||
|
*/
|
||||||
|
function getLibStatut($mode=0)
|
||||||
|
{
|
||||||
|
return $this->LibStatut($this->statut,$mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Renvoi le libellé d'un statut donné
|
||||||
|
* \param statut Id statut
|
||||||
|
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||||
|
* \return string Libellé du statut
|
||||||
|
*/
|
||||||
|
function LibStatut($statut,$mode=0)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load('users');
|
||||||
|
|
||||||
|
if ($mode == 0)
|
||||||
|
{
|
||||||
|
$prefix='';
|
||||||
|
if ($statut == 1) return $langs->trans('Enabled');
|
||||||
|
if ($statut == 0) return $langs->trans('Disabled');
|
||||||
|
}
|
||||||
|
if ($mode == 1)
|
||||||
|
{
|
||||||
|
if ($statut == 1) return $langs->trans('Enabled');
|
||||||
|
if ($statut == 0) return $langs->trans('Disabled');
|
||||||
|
}
|
||||||
|
if ($mode == 2)
|
||||||
|
{
|
||||||
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||||
|
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||||
|
}
|
||||||
|
if ($mode == 3)
|
||||||
|
{
|
||||||
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
||||||
|
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
||||||
|
}
|
||||||
|
if ($mode == 4)
|
||||||
|
{
|
||||||
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||||
|
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||||
|
}
|
||||||
|
if ($mode == 5)
|
||||||
|
{
|
||||||
|
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||||
|
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -87,7 +87,18 @@ if ($_POST["action"] == 'confirm_disable' && $_POST["confirm"] == "yes")
|
|||||||
{
|
{
|
||||||
$edituser = new User($db, $_GET["id"]);
|
$edituser = new User($db, $_GET["id"]);
|
||||||
$edituser->fetch($_GET["id"]);
|
$edituser->fetch($_GET["id"]);
|
||||||
$edituser->disable();
|
$edituser->setstatus(0);
|
||||||
|
Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_POST["action"] == 'confirm_enable' && $_POST["confirm"] == "yes")
|
||||||
|
{
|
||||||
|
if ($_GET["id"] <> $user->id)
|
||||||
|
{
|
||||||
|
$edituser = new User($db, $_GET["id"]);
|
||||||
|
$edituser->fetch($_GET["id"]);
|
||||||
|
$edituser->setstatus(1);
|
||||||
Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]);
|
Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -106,7 +117,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
|
|||||||
}
|
}
|
||||||
|
|
||||||
//reactive un compte ldap
|
//reactive un compte ldap
|
||||||
if ($conf->ldap->enabled && $_GET["action"] == 'reactivate' && $canadduser)
|
if ($conf->ldap->enabled && $_GET["action"] == 'reactivate' && $candisableuser)
|
||||||
{
|
{
|
||||||
if ($_GET["id"] <> $user->id)
|
if ($_GET["id"] <> $user->id)
|
||||||
{
|
{
|
||||||
@ -240,8 +251,8 @@ if ($_POST["action"] == 'update' && $caneditfield)
|
|||||||
$edituser->pass = trim($_POST["pass"]);
|
$edituser->pass = trim($_POST["pass"]);
|
||||||
$edituser->admin = trim($_POST["admin"]);
|
$edituser->admin = trim($_POST["admin"]);
|
||||||
$edituser->office_phone = trim($_POST["office_phone"]);
|
$edituser->office_phone = trim($_POST["office_phone"]);
|
||||||
$edituser->office_fax = trim($_POST["office_fax"]);
|
$edituser->office_fax = trim($_POST["office_fax"]);
|
||||||
$edituser->user_mobile = trim($_POST["user_mobile"]);
|
$edituser->user_mobile = trim($_POST["user_mobile"]);
|
||||||
$edituser->email = trim($_POST["email"]);
|
$edituser->email = trim($_POST["email"]);
|
||||||
$edituser->note = trim($_POST["note"]);
|
$edituser->note = trim($_POST["note"]);
|
||||||
$edituser->webcal_login = trim($_POST["webcal_login"]);
|
$edituser->webcal_login = trim($_POST["webcal_login"]);
|
||||||
@ -565,6 +576,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// EMail
|
||||||
print '<tr><td valign="top">'.$langs->trans("EMail").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("EMail").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($ldap_mail)
|
if ($ldap_mail)
|
||||||
@ -709,6 +721,15 @@ else
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Confirmation activation
|
||||||
|
*/
|
||||||
|
if ($action == 'enable')
|
||||||
|
{
|
||||||
|
$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnabledUser",$fuser->login),"confirm_enable");
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation suppression
|
* Confirmation suppression
|
||||||
*/
|
*/
|
||||||
@ -744,20 +765,17 @@ else
|
|||||||
print '<td width="50%">'.$fuser->prenom.'</td>';
|
print '<td width="50%">'.$fuser->prenom.'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
// Login
|
||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Login").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Login").'</td>';
|
||||||
if ($fuser->login)
|
if ($fuser->ldap_sid)
|
||||||
{
|
{
|
||||||
print '<td width="50%">'.$fuser->login;
|
print '<td width="50%" class="error">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
|
||||||
}
|
|
||||||
else if ($fuser->ldap_sid)
|
|
||||||
{
|
|
||||||
print '<td width="50%" class="error">'.$langs->trans("LoginAccountDisableInDolibarr");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td width="50%" class="error">'.$langs->trans("LoginAccountDisable");
|
print '<td width="50%">'.$fuser->login.'</td>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Password
|
// Password
|
||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Password").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Password").'</td>';
|
||||||
@ -836,10 +854,17 @@ else
|
|||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Mobile").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Mobile").'</td>';
|
||||||
print '<td width="50%">'.$fuser->user_mobile.'</td>';
|
print '<td width="50%">'.$fuser->user_mobile.'</td>';
|
||||||
|
|
||||||
|
// EMail
|
||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("EMail").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("EMail").'</td>';
|
||||||
print '<td width="50%"><a href="mailto:'.$fuser->email.'">'.$fuser->email.'</a></td>';
|
print '<td width="50%"><a href="mailto:'.$fuser->email.'">'.$fuser->email.'</a></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
// Statut
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $fuser->getLibStatut(4);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("DateCreation").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("DateCreation").'</td>';
|
||||||
print '<td>'.dolibarr_print_date($fuser->datec,"%d/%m/%Y %H:%M:%S").'</td>';
|
print '<td>'.dolibarr_print_date($fuser->datec,"%d/%m/%Y %H:%M:%S").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -883,18 +908,12 @@ else
|
|||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if ($caneditfield && (!$fuser->ldap_sid || !$fuser->login))
|
|
||||||
|
if ($caneditfield)
|
||||||
{
|
{
|
||||||
if ($canadduser && $fuser->ldap_sid && !$fuser->login)
|
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=edit">'.$langs->trans("Edit").'</a>';
|
||||||
{
|
|
||||||
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=reactivate">'.$langs->trans("Reactivate").'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=edit">'.$langs->trans("Edit").'</a>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
elseif ($caneditpassword && !$fuser->ldap_sid)
|
elseif ($caneditpassword && ! $fuser->ldap_sid)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=edit">'.$langs->trans("EditPassword").'</a>';
|
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=edit">'.$langs->trans("EditPassword").'</a>';
|
||||||
}
|
}
|
||||||
@ -913,7 +932,13 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->id <> $_GET["id"] && $candisableperms && $fuser->login)
|
// Activer
|
||||||
|
if ($user->id <> $_GET["id"] && $candisableperms && $fuser->statut == 0)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=enable">'.$langs->trans("Reactivate").'</a>';
|
||||||
|
}
|
||||||
|
// Desactiver
|
||||||
|
if ($user->id <> $_GET["id"] && $candisableperms && $fuser->statut == 1)
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="fiche.php?action=disable&id='.$fuser->id.'">'.$langs->trans("DisableUser").'</a>';
|
print '<a class="butActionDelete" href="fiche.php?action=disable&id='.$fuser->id.'">'.$langs->trans("DisableUser").'</a>';
|
||||||
}
|
}
|
||||||
@ -1184,12 +1209,20 @@ else
|
|||||||
else print $fuser->user_mobile;
|
else print $fuser->user_mobile;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// EMail
|
||||||
print "<tr>".'<td valign="top">'.$langs->trans("EMail").'</td>';
|
print "<tr>".'<td valign="top">'.$langs->trans("EMail").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($caneditfield) print '<input size="40" type="text" name="email" class="flat" value="'.$fuser->email.'">';
|
if ($caneditfield) print '<input size="40" type="text" name="email" class="flat" value="'.$fuser->email.'">';
|
||||||
else print $fuser->email;
|
else print $fuser->email;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Statut
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $fuser->getLibStatut(4);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Note
|
||||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="2">';
|
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="2">';
|
||||||
if ($caneditfield)
|
if ($caneditfield)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user