Merge pull request 'For compatibility with the ldap_*() functions of PHP 8.1+' (#18) from fix_issue15_error_500_on_log_in into master
All checks were successful
gitea/evoadmin-mail/pipeline/head This commit looks good

Reviewed-on: #18
This commit is contained in:
mgauthier 2024-10-30 16:03:57 +01:00
commit 532e3d054a

View file

@ -77,10 +77,13 @@ class LdapServer {
public function login($password) {
$sr=ldap_search($this->conn, self::getBaseDN($this), "(&(uid=".$this->login.")(isAdmin=TRUE))");
if ($sr !== false) {
$info = ldap_get_entries($this->conn, $sr);
if (!$info['count']) {
Logger::error('Invalid login for '.$this->login);
throw new Exception("Échec de l'authentification, utilisateur ou mot de passe incorrect.");
if ($info == false || !$info['count']) {
Logger::error('Invalid login for '.$this->login);
throw new Exception("Échec de l'authentification, utilisateur ou mot de passe incorrect.");
}
}
if (!@ldap_bind($this->conn, $info[0]['dn'], $password)) {