stages/password: catch importerror during authentic()

This commit is contained in:
Jens Langhammer 2021-01-17 20:18:45 +01:00
parent 217cca822d
commit 4b551add1a
1 changed files with 5 additions and 1 deletions

View File

@ -31,7 +31,11 @@ def authenticate(
Customized version of django's authenticate, which accepts a list of backends"""
for backend_path in backends:
try:
backend: BaseBackend = path_to_class(backend_path)()
except ImportError:
LOGGER.warning("Failed to import backend", path=backend_path)
continue
LOGGER.debug("Attempting authentication...", backend=backend)
user = backend.authenticate(request, **credentials)
if user is None: