Module: check_mk
Branch: master
Commit: f75c33af0843d8e79ba0e7e0bb4f0abb2f687c28
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f75c33af0843d8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Sep 28 15:43:27 2012 +0200
FIX: Fixed login/login confusions with index page caching
---
ChangeLog | 1 +
web/htdocs/htmllib.py | 19 +++++++++++++++----
web/htdocs/login.py | 8 ++++----
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ae1d0c1..ae1da6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@
* BI: Added new config option bi_compile_log to collect statistics about
aggregation compilations
* FIX: Fixed releasing of locks and livestatus connections when logging out
+ * FIX: Fixed login/login confusions with index page caching
1.2.0p3:
Mulitisite
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 9805478..9bbc669 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -49,13 +49,17 @@ class uriinfo:
# TODO: URI-Encode von Variablen!
def geturi(self):
uri = self.req.myfile + ".py"
- if len(self.req.vars):
+ if self.req.vars:
uri += "?" + urlencode(self.req.vars.items())
return uri
# [('varname1', value1), ('varname2', value2) ]
def makeuri(self, addvars):
- return self.req.myfile + ".py?" + urlencode_vars(self.req.vars.items()
+ addvars)
+ v = self.req.vars.items() + addvars
+ if v:
+ return self.req.myfile + ".py?" + urlencode_vars(v)
+ else:
+ return self.req.myfile + ".py"
# Liste von Hidden-Felder erzeugen aus aktueller URI
def hiddenfields(self, omit=[]):
@@ -330,13 +334,20 @@ class html:
vars = [ (v, self.var(v)) for v in self.req.vars if v[0] != "_" ]
if remove_prefix != None:
vars = [ i for i in vars if not i[0].startswith(remove_prefix) ]
- return self.req.myfile + ".py?" + urlencode_vars(vars + addvars)
+ vars = vars + addvars
+ if vars:
+ return self.req.myfile + ".py?" + urlencode_vars(vars)
+ else:
+ return self.req.myfile + ".py"
def makeactionuri(self, addvars):
return self.makeuri(addvars + [("_transid", self.fresh_transid())])
def makeuri_contextless(self, vars):
- return self.req.myfile + ".py?" + urlencode_vars(vars)
+ if vars:
+ return self.req.myfile + ".py?" + urlencode_vars(vars)
+ else:
+ return self.req.myfile + ".py"
def image_button(self, varname, title, cssclass = ''):
if not self.mobile:
diff --git a/web/htdocs/login.py b/web/htdocs/login.py
index aff6fa1..07303b0 100644
--- a/web/htdocs/login.py
+++ b/web/htdocs/login.py
@@ -158,7 +158,7 @@ def do_login():
raise MKUserError('_password', _('No password given.'))
origtarget = html.var('_origtarget')
- if not origtarget or origtarget.endswith("/logout.py"):
+ if not origtarget or "logout.py" in origtarget:
origtarget = defaults.url_prefix + 'check_mk/'
users = load_htpasswd()
@@ -220,14 +220,14 @@ def normal_login_page(called_directly = True):
html.header(_("Check_MK Multisite Login"), javascripts=[],
stylesheets=["pages", "login"])
origtarget = html.var('_origtarget', '')
- if not origtarget and not html.req.myfile == 'login':
+ if not origtarget and not html.req.myfile in [ 'login', 'logout' ]:
origtarget = html.makeuri([])
# When e.g. the password of a user is changed and the first frame that recognizes
the
# non matching cookies is the sidebar it redirects the user to side.py while
removing
# the frameset. This is not good. Instead of this redirect the user to the index
page.
if html.req.myfile == 'side':
- html.immediate_browser_redirect(0.1, 'index.py')
+ html.immediate_browser_redirect(0.1, 'login.py')
return apache.OK
# Never allow the login page to be opened in a frameset. Redirect top page to login
page.
@@ -281,7 +281,7 @@ def page_logout():
del_auth_cookie()
if config.auth_type == 'cookie':
- html.set_http_header('Location', defaults.url_prefix +
'check_mk/')
+ html.set_http_header('Location', defaults.url_prefix +
'check_mk/login.py')
raise apache.SERVER_RETURN, apache.HTTP_MOVED_TEMPORARILY
else:
# Implement HTTP logout with cookie hack