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.
This commit is contained in:
chhemme
2020-03-23 16:43:09 +01:00
committed by GitHub
parent 30edba01ed
commit d667a1b3d9

View File

@@ -70,6 +70,12 @@ class LoginLDAPPlugin extends Plugin
{ {
$credentials = $event->getCredentials(); $credentials = $event->getCredentials();
// empty username -> ignore
if($credentials['username'] == ''){
$event->setStatus($event::AUTHENTICATION_FAILURE);
return;
}
// Get Proper username // Get Proper username
$user_dn = $this->config->get('plugins.login-ldap.user_dn'); $user_dn = $this->config->get('plugins.login-ldap.user_dn');
$search_dn = $this->config->get('plugins.login-ldap.search_dn'); $search_dn = $this->config->get('plugins.login-ldap.search_dn');