diff --git a/Client.cpp b/Client.cpp index b8035459..a514099d 100644 --- a/Client.cpp +++ b/Client.cpp @@ -628,6 +628,16 @@ void CClientAuth::RefusedLogin(const CString& sReason) { } void CAuthBase::RefuseLogin(const CString& sReason) { + CUser* pUser = GetUser(GetUsername()); + + // If the username is valid, notify that user that someone tried to + // login. Use sReason because there are other reasons than "wrong + // password" for a login to be rejected (e.g. fail2ban). + if (pUser) { + pUser->PutStatus("Another client attempted to login as you [" + + sReason + "]."); + } + #ifdef _MODULES CZNC::Get().GetModules().OnFailedLogin(GetUsername(), GetRemoteIP()); #endif diff --git a/znc.cpp b/znc.cpp index e3565ee3..3aac144a 100644 --- a/znc.cpp +++ b/znc.cpp @@ -1750,10 +1750,6 @@ void CZNC::AuthUser(CSmartPtr AuthClass) { CUser* pUser = GetUser(AuthClass->GetUsername()); if (!pUser || !pUser->CheckPass(AuthClass->GetPassword())) { - if (pUser) { - pUser->PutStatus("Another client attempted to login as you, with a bad password."); - } - AuthClass->RefuseLogin("Invalid Password"); return; }