web/views/basetemplates.py
changeset 8311 76a44a0d7f4b
parent 8310 87f2f18a77ef
child 8324 75694a61f089
--- a/web/views/basetemplates.py	Thu Mar 01 12:08:35 2012 +0100
+++ b/web/views/basetemplates.py	Thu Mar 15 17:42:31 2012 +0100
@@ -447,7 +447,11 @@
 
     def form_action(self):
         if self.action is None:
-            return login_form_url(self._cw)
+            # reuse existing redirection if it exist
+            target = self._cw.form.get('postlogin_path',
+                                       self._cw.relative_path())
+            return self._cw.build_url('login', __secure__=True,
+                                      postlogin_path=target)
         return super(LogForm, self).form_action()
 
 class LogForm(BaseLogForm):
@@ -507,12 +511,3 @@
         cw.html_headers.add_onload('jQuery("#__login:visible").focus()')
 
 LogFormTemplate = class_renamed('LogFormTemplate', LogFormView)
-
-
-def login_form_url(req):
-    if req.https:
-        return req.url()
-    httpsurl = req.vreg.config.get('https-url')
-    if httpsurl:
-        return req.url().replace(req.base_url(), httpsurl)
-    return req.url()