policies/reputation: only change score when credentials contain username

This commit is contained in:
Jens Langhammer 2020-07-07 22:25:37 +02:00
parent 5644e57e6a
commit 8c500c38b1
1 changed files with 2 additions and 1 deletions

View File

@ -32,7 +32,8 @@ def update_score(request: HttpRequest, username: str, amount: int):
# pylint: disable=unused-argument
def handle_failed_login(sender, request, credentials, **_):
"""Lower Score for failed loging attempts"""
update_score(request, credentials.get("username"), -1)
if "username" in credentials:
update_score(request, credentials.get("username"), -1)
@receiver(user_logged_in)