Added sanity check to determine if a bind user account is set. (#9340)

This commit is contained in:
Raell Dottin 2021-03-24 17:08:37 -04:00 committed by GitHub
parent b00413e8aa
commit 78cc47a859
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -129,7 +129,13 @@ class LdapAd extends LdapAdConfiguration
$login_username = $username; $login_username = $username;
} }
if ($this->ldap->auth()->attempt($login_username, $password, true) === false) { if ($this->ldapConfig['username'] && $this->ldapConfig['password']) {
$bind_as_user = false;
} else {
$bind_as_user = true;
}
if ($this->ldap->auth()->attempt($login_username, $password, $bind_as_user) === false) {
throw new Exception('Unable to validate user credentials!'); throw new Exception('Unable to validate user credentials!');
} }