From 04d76acce564d35915cfd03bbc394803bfa0491c Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Mon, 4 Nov 2024 10:52:38 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=85(backend)=20handle=20inactive=20user?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handle case where user is inactive. Previously this edge case would cause unexpected behavior. Related to previous commit that added the test coverage. --- src/backend/core/authentication/backends.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/core/authentication/backends.py b/src/backend/core/authentication/backends.py index ddfa60ad..ae1a2b2f 100644 --- a/src/backend/core/authentication/backends.py +++ b/src/backend/core/authentication/backends.py @@ -83,4 +83,10 @@ class OIDCAuthenticationBackend(MozillaOIDCAuthenticationBackend): else: user = None + if not user: + return None + + if not user.is_active: + raise SuspiciousOperation(_("User account is disabled")) + return user