Fix: wrong field to show password

This commit is contained in:
Laurent Destailleur 2012-01-08 18:37:29 +01:00
parent 159417898e
commit 62afb3da4b

View File

@ -34,9 +34,10 @@ $langs->load("members");
$langs->load("ldap"); $langs->load("ldap");
$langs->load("admin"); $langs->load("admin");
// Protection quand utilisateur externe $rowid = GETPOST("id");
$rowid = isset($_GET["id"])?$_GET["id"]:''; $action = GETPOST('action');
// Protection
$socid=0; $socid=0;
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
@ -52,11 +53,12 @@ if (! $result)
exit; exit;
} }
/* /*
* Actions * Actions
*/ */
if ($_GET["action"] == 'dolibarr2ldap') if ($action == 'dolibarr2ldap')
{ {
$message=""; $message="";
@ -121,7 +123,7 @@ print '<tr><td>'.$langs->trans("Login").'</td><td class="valeur">'.$adh->login.'
if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD) if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD)
{ {
print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>'; print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>';
print '<td class="valeur">'.$fuser->pass.'</td>'; print '<td class="valeur">'.$adh->pass.'</td>';
print "</tr>\n"; print "</tr>\n";
} }
@ -129,7 +131,7 @@ if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD)
if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED) if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)
{ {
print '<tr><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td>'; print '<tr><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td>';
print '<td class="valeur">'.$fuser->pass_crypted.'</td>'; print '<td class="valeur">'.$adh->pass_crypted.'</td>';
print "</tr>\n"; print "</tr>\n";
} }
@ -194,26 +196,35 @@ if ($result > 0)
$info=$adh->_load_ldap_info(); $info=$adh->_load_ldap_info();
$dn=$adh->_load_ldap_dn($info,1); $dn=$adh->_load_ldap_dn($info,1);
$search = "(".$adh->_load_ldap_dn($info,2).")"; $search = "(".$adh->_load_ldap_dn($info,2).")";
$records=$ldap->getAttribute($dn,$search);
//print_r($records); if (empty($dn))
{
$langs->load("errors");
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete").'</font></td></tr>';
}
else
{
$records=$ldap->getAttribute($dn,$search);
// Affichage arbre //print_r($records);
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
{ // Affichage arbre
if (! is_array($records)) if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
{ {
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; if (! is_array($records))
} {
else print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
{ }
$result=show_ldap_content($records,0,$records['count'],true); else
} {
} $result=show_ldap_content($records,0,$records['count'],true);
else }
{ }
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>'; else
} {
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
}
}
$ldap->unbind(); $ldap->unbind();
$ldap->close(); $ldap->close();
@ -227,9 +238,7 @@ else
print '</table>'; print '</table>';
llxFooter();
$db->close(); $db->close();
llxFooter();
?> ?>