-
Notifications
You must be signed in to change notification settings - Fork 104
Description
I use django-auth-ldap in combination with django-axes, which locks out users after too many failed login attempts. I recently had a situation where the LDAP server was not reachable. Users who tried to log in during that time were locked out by django-axes, which made the situation even worse. Even after the LDAP server was reachable again, many users were still unable to log in.
As far as I understand, a fix would be to use the ldap_error
signal to raise exceptions if the connection fails:
from django_auth_ldap.backend import ldap_error
from django.dispatch import receiver
@receiver(ldap_error)
def raise_ldap_error(sender, user, request, exception, **kwargs):
raise exception
However, I am using a third party software, so I can only change the settings. If I try to add this signal handler in the settings, I get the following error:
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Note that it wouldn't work to add the signal handler to the software itself, because it can be combined with different authentication backends. This handler only makes sense for my specific setup.
So my request is to add a boolean setting (e.g. AUTH_LDAP_RAISE_LDAP_ERRORS
). I would also be fine with more flexible solutions, as long as they can be used in the settings, without modifying application code.