Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions authentication/views/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ def login_api_view(request):
# The authenticate method below will return None for inactive users
# We want to show inactive users an error message so they can activate
# their account, and also to re-send their activation email
user = User.objects.filter(
Q(username__iexact=login) | Q(email__iexact=login)
).first()
user = AuthLoginBackend.find_user(login)

if user is not None and user.check_password(password) and not user.is_active:
if user and not user.is_active and user.check_password(password):
Copy link
Contributor Author

@hlbmtc hlbmtc Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elisescu user.check_password is expensive operation, so moved it to the end

send_activation_email(user, None)
raise ValidationError({"user_state": "inactive"})

Expand Down