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

View file

@ -32,7 +32,8 @@ def update_score(request: HttpRequest, username: str, amount: int):
# pylint: disable=unused-argument # pylint: disable=unused-argument
def handle_failed_login(sender, request, credentials, **_): def handle_failed_login(sender, request, credentials, **_):
"""Lower Score for failed loging attempts""" """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) @receiver(user_logged_in)