Fix: on vrifie si le user existe
This commit is contained in:
parent
6269a9b353
commit
cadb9efdf9
@ -111,7 +111,7 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
||||
{
|
||||
$resultFetchLdapUser = $ldap->fetch($_POST["username"]);
|
||||
// On stop si le mot de passe ldap doit etre modifie sur le domaine
|
||||
if ($resultFetchLdapUser == 1 && $ldap->pwdlastset <= 0)
|
||||
if ($resultFetchLdapUser == 1 && $ldap->pwdlastset == 0)
|
||||
{
|
||||
dolibarr_syslog('functions_ldap::User '.$login.' must change password next logon');
|
||||
if ($ldapdebug) print "DEBUG: User ".$login." must change password<br>\n";
|
||||
|
||||
@ -872,17 +872,21 @@ class Ldap
|
||||
$i = 0;
|
||||
$searchDN = $this->people;
|
||||
|
||||
$result = '';
|
||||
|
||||
while ($i <= 2)
|
||||
{
|
||||
$this->result = @ldap_search($this->connection, $searchDN, $filter);
|
||||
|
||||
if (!$this->result)
|
||||
if ($this->result)
|
||||
{
|
||||
$result = @ldap_get_entries( $this->connection, $this->result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$result = @ldap_get_entries( $this->connection, $this->result);
|
||||
}
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
@ -914,6 +918,7 @@ class Ldap
|
||||
|
||||
$this->uacf = $this->parseUACF($this->ldap_utf8_decode($result[0]["useraccountcontrol"][0]));
|
||||
$this->pwdlastset = ($result[0]["pwdlastset"][0] != 0)?$this->convert_time($this->ldap_utf8_decode($result[0]["pwdlastset"][0])):0;
|
||||
if (!$this->name && !$this->login) $this->pwdlastset = -1;
|
||||
$this->badpwdtime = $this->convert_time($this->ldap_utf8_decode($result[0]["badpasswordtime"][0]));
|
||||
|
||||
ldap_free_result($this->result);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user