From d667a1b3d916566f52dbfdb21f8082083f35e45d Mon Sep 17 00:00:00 2001 From: chhemme Date: Mon, 23 Mar 2020 16:43:09 +0100 Subject: [PATCH] Ignore authentication requests with empty username When using login-ldap with the admin panel I get an LDAP exception because the query is invalid. It looks like the plugin sends an empty login request when loading the admin login page. This causes an invalid query. --- login-ldap.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/login-ldap.php b/login-ldap.php index 4ea70e4..70aef6a 100644 --- a/login-ldap.php +++ b/login-ldap.php @@ -69,6 +69,12 @@ class LoginLDAPPlugin extends Plugin public function userLoginAuthenticate(UserLoginEvent $event) { $credentials = $event->getCredentials(); + + // empty username -> ignore + if($credentials['username'] == ''){ + $event->setStatus($event::AUTHENTICATION_FAILURE); + return; + } // Get Proper username $user_dn = $this->config->get('plugins.login-ldap.user_dn');