From 57c81b2f4277749fb216c2e9944ff072425a71c8 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 8 Dec 2022 17:41:47 +0530 Subject: [PATCH] fix: log unknown usernames too for failed attempts (#19199) [skip ci] --- frappe/auth.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frappe/auth.py b/frappe/auth.py index e4bde99907..d1dc10817c 100644 --- a/frappe/auth.py +++ b/frappe/auth.py @@ -230,10 +230,11 @@ class LoginManager: if not (user and pwd): self.fail(_("Incomplete login details"), user=user) + _raw_user_name = user user = User.find_by_credentials(user, pwd) if not user: - self.fail("Invalid login credentials") + self.fail("Invalid login credentials", user=_raw_user_name) # Current login flow uses cached credentials for authentication while checking OTP. # Incase of OTP check, tracker for auth needs to be disabled(If not, it can remove tracker history as it is going to succeed anyway)