Fix LDAP with internal users (#4453)

* added logging, in case Laminas libs are not available
* make sure that internal users can still login if LDAP is activated
This commit is contained in:
Kevin Papst
2023-11-20 21:33:36 +01:00
committed by GitHub
parent 20164295f8
commit 16d4a691f8
4 changed files with 15 additions and 10 deletions

View File

@@ -62,12 +62,12 @@ final class LdapCredentialsSubscriber implements EventSubscriberInterface
throw new BadCredentialsException('The presented user needs to be a Kimai user.');
}
// removing this code allows to upgrade from local to LDAP users
// if (!$user->isLdapUser()) {
// return;
// }
if (!$this->ldapManager->bind($user->getUserIdentifier(), $presentedPassword)) {
// if the login failed and the user is registered with "kimai" auth, simply return:
// the FormLogin authenticator will take over and the user can log in via internal database
if (!$user->isLdapUser()) {
return;
}
throw new BadCredentialsException('The presented password is invalid.');
}