Skip to content

Commit 43b613d

Browse files
authored
Login speed improvement (#3894)
1 parent fb5b976 commit 43b613d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

authentication/views/common.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@ def login_api_view(request):
4747
# The authenticate method below will return None for inactive users
4848
# We want to show inactive users an error message so they can activate
4949
# their account, and also to re-send their activation email
50-
user = User.objects.filter(
51-
Q(username__iexact=login) | Q(email__iexact=login)
52-
).first()
50+
user = AuthLoginBackend.find_user(login)
5351

54-
if user is not None and user.check_password(password) and not user.is_active:
52+
if user and not user.is_active and user.check_password(password):
5553
send_activation_email(user, None)
5654
raise ValidationError({"user_state": "inactive"})
5755

0 commit comments

Comments
 (0)