Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit ec855b2

Browse files
committed
Make sure the username isn't empty.
1 parent e1e2cd2 commit ec855b2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/AdldapAuthUserProvider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,15 @@ protected function authenticate($username, $password)
143143
*/
144144
protected function authenticateWithCredentials(array $credentials = [])
145145
{
146+
$username = $this->getUsernameFromCredentials($credentials);
147+
146148
// Make sure we're connected to our LDAP server before we run any operations.
147-
if ($this->isConnected()) {
149+
if ($this->isConnected() && !empty($username)) {
148150
// Due to having the ability of choosing which attribute we login users
149151
// with, we actually need to retrieve the user from our LDAP server
150152
// before hand so we can retrieve these attributes.
151153
$user = $this->newAdldapUserQuery()->where([
152-
$this->getUsernameValue() => $this->getUsernameFromCredentials($credentials)
154+
$this->getUsernameValue() => $username,
153155
])->first();
154156

155157
if ($user instanceof User) {

0 commit comments

Comments
 (0)