mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
WebMods: Add an error message for users that have cookie support turned off.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1839 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -87,7 +87,7 @@ void CWebAuth::AcceptedLogin(CUser& User) {
|
||||
|
||||
m_pWebSock->SetLoggedIn(true);
|
||||
m_pWebSock->UnPauseRead();
|
||||
m_pWebSock->Redirect("/");
|
||||
m_pWebSock->Redirect("/?cookie_check=true");
|
||||
|
||||
DEBUG("Successful login attempt ==> USER [" + User.GetUserName() + "] ==> SESSION [" + spSession->GetId() + "]");
|
||||
}
|
||||
@@ -103,7 +103,7 @@ void CWebAuth::RefusedLogin(const CString& sReason) {
|
||||
|
||||
m_pWebSock->SetLoggedIn(false);
|
||||
m_pWebSock->UnPauseRead();
|
||||
m_pWebSock->Redirect("/");
|
||||
m_pWebSock->Redirect("/?cookie_check=true");
|
||||
|
||||
DEBUG("UNSUCCESSFUL login attempt ==> REASON [" + sReason + "] ==> SESSION [" + spSession->GetId() + "]");
|
||||
}
|
||||
@@ -516,6 +516,8 @@ void CWebSock::OnPageRequest(const CString& sURI) {
|
||||
}
|
||||
|
||||
CWebSock::EPageReqResult CWebSock::OnPageRequestInternal(const CString& sURI, CString& sPageRet) {
|
||||
bool bNoCookie = (GetCookie("SessionId").empty());
|
||||
|
||||
m_spSession = GetSession();
|
||||
SetCookie("SessionId", m_spSession->GetId());
|
||||
|
||||
@@ -526,6 +528,9 @@ CWebSock::EPageReqResult CWebSock::OnPageRequestInternal(const CString& sURI, CS
|
||||
|
||||
// Handle the static pages that don't require a login
|
||||
if (sURI == "/") {
|
||||
if(!m_bLoggedIn && GetParam("cookie_check").ToBool() && bNoCookie) {
|
||||
m_spSession->AddError("Your browser does not have cookies enabled for this site!");
|
||||
}
|
||||
return PrintTemplate("index", sPageRet);
|
||||
} else if (sURI == "/favicon.ico") {
|
||||
return PrintStaticFile("/pub/favicon.ico", sPageRet);
|
||||
|
||||
Reference in New Issue
Block a user