If the postlogin_path is 'login', redirect to '/' instead
authorChristophe de Vienne <christophe@unlish.com>
Mon, 04 Aug 2014 13:06:32 +0200
changeset 11494 79ce84750c18
parent 11493 00e5cb9771c5
child 11495 f936708c6ea2
If the postlogin_path is 'login', redirect to '/' instead Related to #4291173
pyramid_cubicweb/login.py
--- a/pyramid_cubicweb/login.py	Mon Aug 04 13:04:19 2014 +0200
+++ b/pyramid_cubicweb/login.py	Mon Aug 04 13:06:32 2014 +0200
@@ -26,11 +26,12 @@
     if user_eid is not None:
         headers = security.remember(request, user_eid)
 
-        raise HTTPSeeOther(
-            request.params.get('postlogin_path', '/'),
-            headers=headers)
+        new_path = request.params.get('postlogin_path', '/')
 
-        response.headerlist.extend(headers)
+        if new_path == 'login':
+            new_path = '/'
+
+        raise HTTPSeeOther(new_path, headers=headers)
 
     response.text = render_view(request, 'login')
     return response