Commit a51d14f5 authored by Valentin Samir's avatar Valentin Samir

[wiki] Délogue si page pas publique et précédement pseudo-logué

parent e4f4a7a8
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - login action
The real login is done in MoinMoin.request.
Here is only some user notification in case something went wrong.
@copyright: 2005-2006 Radomirs Cirskis <nad2000@gmail.com>,
2006 MoinMoin:ThomasWaldmann
@license: GNU GPL, see COPYING for details.
"""
from MoinMoin import userform, wikiutil
from MoinMoin.Page import Page
from MoinMoin.widget import html
def execute(pagename, request):
_ = request.getText
request.theme.send_title(_("Access denied"), pagename=pagename)
# Start content (important for RTL support)
request.write(request.formatter.startContent("content"))
request.write("Vous n'êtes pas autorisé à lire cette page.\n")
request.write(request.formatter.endContent())
request.theme.send_footer(pagename)
request.theme.send_closing_html()
# return LoginHandler(pagename, request).handle()
class LoginHandler:
def __init__(self, pagename, request):
self.request = request
self._ = request.getText
self.cfg = request.cfg
self.pagename = pagename
self.page = Page(request, pagename)
def handle_multistage(self):
"""Handle a multistage request.
If the auth handler wants a multistage request, we
now set up the login form for that.
"""
_ = self._
def handle(self):
_ = self._
request = self.request
form = request.values
error = None
islogin = form.get('login', '')
if islogin: # user pressed login button
if request._login_multistage:
return self.handle_multistage()
if hasattr(request, '_login_messages'):
for msg in request._login_messages:
request.theme.add_msg(wikiutil.escape(msg), "error")
return self.page.send_page()
else: # show login form
request.theme.send_title(_("Login"), pagename=self.pagename)
# Start content (important for RTL support)
request.write(request.formatter.startContent("content"))
request.write(userform.getLogin(request))
request.write(request.formatter.endContent())
request.theme.send_footer(self.pagename)
request.theme.send_closing_html()
......@@ -70,7 +70,7 @@ class PublicCategories(AnonymousAuth):
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")
if action != "deny":
request.http_redirect(url + "?action=deny")
return user_obj, cont
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment