mirror of
https://github.com/znc/znc.git
synced 2026-07-04 00:41:38 +02:00
Unify some of the webadmin and client authentication code in CZNC::AuthUser()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1114 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -1693,6 +1693,35 @@ void CZNC::UpdateTrafficStats() {
|
||||
}
|
||||
}
|
||||
|
||||
void CZNC::AuthUser(CSmartPtr<CAuthBase> AuthClass) {
|
||||
#ifdef _MODULES
|
||||
// TODO unless the auth module calls it, CUser::IsHostAllowed() is not honoured
|
||||
if (GetModules().OnLoginAttempt(AuthClass)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
CString sHost = AuthClass->GetRemoteIP();
|
||||
|
||||
if (!pUser->IsHostAllowed(sHost)) {
|
||||
AuthClass->RefuseLogin("Your host [" + sHost + "] is not allowed");
|
||||
return;
|
||||
}
|
||||
|
||||
AuthClass->AcceptLogin(*pUser);
|
||||
}
|
||||
|
||||
class CConnectUserTimer : public CCron {
|
||||
public:
|
||||
CConnectUserTimer(int iSecs) : CCron() {
|
||||
|
||||
Reference in New Issue
Block a user