Skip to content

Commit

Permalink
Added sanity check to determine if a bind user account is set. (#9340)
Browse files Browse the repository at this point in the history
  • Loading branch information
raelldottin committed Mar 24, 2021
1 parent b00413e commit 78cc47a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/Services/LdapAd.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ public function ldapLogin(string $username, string $password): User
$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!');
}

Expand Down

0 comments on commit 78cc47a

Please sign in to comment.