From 6b2f41214f293a3e1e4999aeb09140c33ca97c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl-David=20Lasseri?= Date: Sun, 2 Aug 2015 01:16:36 +0200 Subject: [PATCH] [anonymous_user.py]: reglages connexion anonyme --- wiki/auth/anonymous_user.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wiki/auth/anonymous_user.py b/wiki/auth/anonymous_user.py index c590a419..3faddee2 100644 --- a/wiki/auth/anonymous_user.py +++ b/wiki/auth/anonymous_user.py @@ -49,6 +49,12 @@ class AnonymousAuth(BaseAuth): if user_obj and user_obj.valid and user_obj.auth_method != self.name and user_obj.name != self.auth_username: return user_obj, True + p = urlparse.urlparse(request.url) + # Prevent preference edition when anonymous + if action == "userprefs" or action == "quicklink": + url = urlparse.urlunparse(('https', p.netloc, p.path, "", "", "")) + request.http_redirect(url) + # anonymous if self.can_view(request): @@ -67,11 +73,7 @@ class AnonymousAuth(BaseAuth): else: u = user_obj - p = urlparse.urlparse(request.url) - # Impossible to edit preferences - if u and u.valid and action == "userprefs": - url = urlparse.urlunparse(('https', p.netloc, p.path, "", "", "")) - request.http_redirect(url) + # If reach anonymous user personnal page, redirect to referer with action=login if p.path == "/%s" % self.auth_username and action != "login": referer_p = urlparse.urlparse(request.http_referer)