mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Fix WebModules with auth modules
When e.g. imapauth started handling a login from WebMods it opened a new TCP connection etc. This took time, but WebMods didn't actually wait for the login to finish which caused the login to fail later on since the HTTP socket was already destroyed. This fixes it by letting the HTTP sock just hang. Once the login finishes, CHTTPSock::Redirect() is called to let it come back to life again. Thanks to DarthGandalf for finding this issue. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1834 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -87,6 +87,7 @@ void CWebAuth::AcceptedLogin(CUser& User) {
|
||||
|
||||
m_pWebSock->SetLoggedIn(true);
|
||||
m_pWebSock->UnPauseRead();
|
||||
m_pWebSock->Redirect("/");
|
||||
|
||||
DEBUG("Successful login attempt ==> USER [" + User.GetUserName() + "] ==> SESSION [" + spSession->GetId() + "]");
|
||||
}
|
||||
@@ -102,6 +103,7 @@ void CWebAuth::RefusedLogin(const CString& sReason) {
|
||||
|
||||
m_pWebSock->SetLoggedIn(false);
|
||||
m_pWebSock->UnPauseRead();
|
||||
m_pWebSock->Redirect("/");
|
||||
|
||||
DEBUG("UNSUCCESSFUL login attempt ==> REASON [" + sReason + "] ==> SESSION [" + spSession->GetId() + "]");
|
||||
}
|
||||
@@ -508,6 +510,9 @@ void CWebSock::OnPageRequest(const CString& sURI) {
|
||||
case PAGE_PRINT:
|
||||
PrintPage(sPageRet);
|
||||
break;
|
||||
case PAGE_DEFERRED:
|
||||
// Something else will later do these calls
|
||||
break;
|
||||
default:
|
||||
PrintNotFound();
|
||||
break;
|
||||
@@ -541,8 +546,8 @@ CWebSock::EPageReqResult CWebSock::OnPageRequestInternal(const CString& sURI, CS
|
||||
m_sPass = GetParam("pass");
|
||||
m_bLoggedIn = OnLogin(m_sUser, m_sPass);
|
||||
|
||||
Redirect("/");
|
||||
return PAGE_PRINT;
|
||||
// AcceptedLogin()/RefusedLogin() will call Redirect()
|
||||
return PAGE_DEFERRED;
|
||||
}
|
||||
|
||||
return PrintTemplate("login", sPageRet);
|
||||
|
||||
Reference in New Issue
Block a user