From 9560cf0bf34f7c551916a51ffd224ff1445b5a8d Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Tue, 29 Oct 2013 20:06:04 +0100 Subject: [PATCH] =?UTF-8?q?[wiki/categorie=5Fpublic]=20Redirection=20vers?= =?UTF-8?q?=20la=20page=20de=20login=20si=20n=C3=A9cessaire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wiki/auth/categorie_public.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wiki/auth/categorie_public.py b/wiki/auth/categorie_public.py index f2e162e4..71e4676c 100644 --- a/wiki/auth/categorie_public.py +++ b/wiki/auth/categorie_public.py @@ -63,3 +63,14 @@ class PublicCategories(AnonymousAuth): sys.stderr.write("%r n'est pas dans la page %r, %r\n" % (cat, p.path[1:], categories)) return False + + def request(self, request, user_obj, **kw): + user_obj, cont = AnonymousAuth.request(self, request, user_obj, **kw) + if user_obj and not user_obj.valid and user_obj.auth_method == self.name: + p = urlparse.urlparse(request.url) + url = urlparse.urlunparse(('https', p.netloc, p.path, "", "", "")) + action = request.args.get("action", "") + if action != "login": + request.http_redirect(url + "?action=login") + return user_obj, cont +