diff options
| author | Tim Graham <timograham@gmail.com> | 2022-07-11 14:27:11 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-11 20:27:11 +0200 |
| commit | 282d58e19385ee4e5c125a9d3cba820949314f3f (patch) | |
| tree | 6d84f54a2239e23abc8408ec6335fa5e951417ad | |
| parent | f8f16b3cd85599b464cbc5c7e884387940c24e6f (diff) | |
Refs #25232 -- Simplified ModelBackend.user_can_authenticate().
Thanks Jay Turner for the suggestion.
| -rw-r--r-- | django/contrib/auth/backends.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py index 1e12efac38..4adcf35051 100644 --- a/django/contrib/auth/backends.py +++ b/django/contrib/auth/backends.py @@ -57,8 +57,7 @@ class ModelBackend(BaseBackend): Reject users with is_active=False. Custom user models that don't have that attribute are allowed. """ - is_active = getattr(user, "is_active", None) - return is_active or is_active is None + return getattr(user, "is_active", True) def _get_user_permissions(self, user_obj): return user_obj.user_permissions.all() |
