[web login] fix after login redirection: redirect expect an url not a relative path. Breaks on cases like '?vid=aview'. Closes #2423575 stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 20 Jul 2012 11:31:34 +0200
branchstable
changeset 8485 8de41063d629
parent 8484 4c1efb5bde0a
child 8486 399e916a97f3
[web login] fix after login redirection: redirect expect an url not a relative path. Breaks on cases like '?vid=aview'. Closes #2423575
web/views/basecontrollers.py
web/views/basetemplates.py
--- a/web/views/basecontrollers.py	Fri Jul 20 10:57:48 2012 +0200
+++ b/web/views/basecontrollers.py	Fri Jul 20 11:31:34 2012 +0200
@@ -91,7 +91,9 @@
     def publish(self, rset=None):
         """log in the instance"""
         path = self._cw.form.get('postlogin_path', '.')
-        raise Redirect(path)
+        # redirect expect an url, not a path. Also path may contains a query
+        # string, hence should not be given to _cw.build_url()
+        raise Redirect(self._cw.base_url() + path)
 
 
 class LogoutController(Controller):
--- a/web/views/basetemplates.py	Fri Jul 20 10:57:48 2012 +0200
+++ b/web/views/basetemplates.py	Fri Jul 20 11:31:34 2012 +0200
@@ -449,7 +449,7 @@
 
     def form_action(self):
         if self.action is None:
-            # reuse existing redirection if it exist
+            # reuse existing redirection if it exists
             target = self._cw.form.get('postlogin_path',
                                        self._cw.relative_path())
             url_args = {}