mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Added sanity check to determine if a bind user account is set. (#9340)
This commit is contained in:
parent
b00413e8aa
commit
78cc47a859
|
@ -129,7 +129,13 @@ class LdapAd extends LdapAdConfiguration
|
|||
$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!');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue