Skip to content
Snippets Groups Projects
Commit d6838334 authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: on vérifie si le user existe

parent 1f0e74f1
Branches
Tags
No related merge requests found
...@@ -111,7 +111,7 @@ function check_user_password_ldap($usertotest,$passwordtotest) ...@@ -111,7 +111,7 @@ function check_user_password_ldap($usertotest,$passwordtotest)
{ {
$resultFetchLdapUser = $ldap->fetch($_POST["username"]); $resultFetchLdapUser = $ldap->fetch($_POST["username"]);
// On stop si le mot de passe ldap doit etre modifie sur le domaine // On stop si le mot de passe ldap doit etre modifie sur le domaine
if ($resultFetchLdapUser && $ldap->pwdlastset <= 0) if ($resultFetchLdapUser == 1 && $ldap->pwdlastset <= 0)
{ {
dolibarr_syslog('functions_ldap::User '.$login.' must change password next logon'); dolibarr_syslog('functions_ldap::User '.$login.' must change password next logon');
if ($ldapdebug) print "DEBUG: User ".$login." must change password<br>\n"; if ($ldapdebug) print "DEBUG: User ".$login." must change password<br>\n";
......
...@@ -900,6 +900,7 @@ class Ldap ...@@ -900,6 +900,7 @@ class Ldap
if (! $result) if (! $result)
{ {
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection); $this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
return -1;
} }
else else
{ {
...@@ -916,6 +917,7 @@ class Ldap ...@@ -916,6 +917,7 @@ class Ldap
$this->badpwdtime = $this->convert_time($this->ldap_utf8_decode($result[0]["badpasswordtime"][0])); $this->badpwdtime = $this->convert_time($this->ldap_utf8_decode($result[0]["badpasswordtime"][0]));
ldap_free_result($this->result); ldap_free_result($this->result);
return 1;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment