From 8c500c38b1f55e60a3f390b74c393355a6a11d68 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 7 Jul 2020 22:25:37 +0200 Subject: [PATCH] policies/reputation: only change score when credentials contain username --- passbook/policies/reputation/signals.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/passbook/policies/reputation/signals.py b/passbook/policies/reputation/signals.py index e7daa8141..08627af87 100644 --- a/passbook/policies/reputation/signals.py +++ b/passbook/policies/reputation/signals.py @@ -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)