easy question ? How to jump back to a previous page..
hello, I've a loginscreen (Session based User folder). In my index_html template is the folowing code : <dtml-if expr="AUTHENTICATED_USER.getUserName() == 'Anonymous User'"> <dtml-call expr="RESPONSE.redirect('/login', lock=1)"> </dtml-if> /login is the login page. But how can I automaticaly jump back (after a succesfull login) to de page that was requested before the loginscreen ? Example: I enter the site (http://beta.swol1894.nl). That page will forward me to the login. After a succesfull login I want a jump to the homepage. (That page send me to the login). Who know's a solution for this ? Greetings, Martin Koekenberg
How about this:: <dtml-if expr="AUTHENTICATED_USER.getUserName() == 'Anonymous User'"> <dtml-call expr="RESPONSE.redirect('/login?came_from='+REQUEST.URL, lock=1)"> </dtml-if> Then your login page will know where to redirect the user back after. This works in principle but you might have to be careful with cached pages. Martin Koekenberg wrote:
hello,
I've a loginscreen (Session based User folder).
In my index_html template is the folowing code :
<dtml-if expr="AUTHENTICATED_USER.getUserName() == 'Anonymous User'"> <dtml-call expr="RESPONSE.redirect('/login', lock=1)"> </dtml-if> /login is the login page. But how can I automaticaly jump back (after a succesfull login) to de page that was requested before the loginscreen ?
Example:
I enter the site (http://beta.swol1894.nl). That page will forward me to the login. After a succesfull login I want a jump to the homepage. (That page send me to the login).
Who know's a solution for this ?
Greetings,
Martin Koekenberg
------------------------------------------------------------------------
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman-20/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman-20/listinfo/zope-announce http://mail.zope.org/mailman-20/listinfo/zope-dev )
-- Peter Bengtsson, http://www.peterbe.com
Martin Koekenberg wrote:
hello,
I've a loginscreen (Session based User folder).
In my index_html template is the folowing code :
<dtml-if expr="AUTHENTICATED_USER.getUserName() == 'Anonymous User'"> <dtml-call expr="RESPONSE.redirect('/login', lock=1)"> </dtml-if> /login is the login page. But how can I automaticaly jump back (after a succesfull login) to de page that was requested before the loginscreen ?
Well...why didn't you redirect the user from your login-page after validation of the data to the desired page..? Usually you use a form to give the user a way to enter their logindata and you process this data with the method in the action-attribute of your form tag. And an advice: Try to use python scripts for logic, not dtml. Otherwise the code of your site becomes a mess :-)
Example:
I enter the site (http://beta.swol1894.nl). That page will forward me to the login. After a succesfull login I want a jump to the homepage. (That page send me to the login).
Who know's a solution for this ?
Greetings,
Martin Koekenberg
------------------------------------------------------------------------
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman-20/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman-20/listinfo/zope-announce http://mail.zope.org/mailman-20/listinfo/zope-dev )
On Thursday 17 June 2004 04:19 am, Martin Koekenberg wrote:
I've a loginscreen (Session based User folder).
In my index_html template is the folowing code :
<dtml-if expr="AUTHENTICATED_USER.getUserName() == 'Anonymous User'"> <dtml-call expr="RESPONSE.redirect('/login', lock=1)"> </dtml-if>
/login is the login page. But how can I automaticaly jump back (after a succesfull login) to de page that was requested before the loginscreen ?
Example:
I enter the site (http://beta.swol1894.nl). That page will forward me to the login. After a succesfull login I want a jump to the homepage. (That page send me to the login).
Who know's a solution for this ?
IIRC, I did it by passing a HTTP GET argument to the login form:
<dtml-call expr="RESPONSE.redirect('/login?origin=' + absolute_url(), lock=1)">
Or something like that (you'll need to deal with quoting problems, etc). Then you just use that value in a redirect (you probably have to submit it again when you actually login, and the "you are logged in" page will be a redirect to your original page. Cheers, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com
* Martin Koekenberg <zope@digital-adventures.nl> [2004-06-17 13:30]:
hello,
I've a loginscreen (Session based User folder).
In my index_html template is the folowing code :
<dtml-if expr="AUTHENTICATED_USER.getUserName() == 'Anonymous User'"> <dtml-call expr="RESPONSE.redirect('/login', lock=1)"> </dtml-if>
/login is the login page. But how can I automaticaly jump back (after a succesfull login) to de page that was requested before the loginscreen ?
Pass it on as a parameter to the login page: <dtml-call expr="RESPONSE.redirect('/login?came_from=%s' % this().absolute_url(), lock=1)"> And submit 'came_from' as a hidden variable to your login script so that it can determine where to redirect after that. -- Roché Compaan Upfront Systems http://www.upfrontsystems.co.za
If you use Cookie Crumbler you will see an option to allow it to generate the login DTML methods for you. You can then go to the security tab of the interfaces or directories you wish to protect and change the 'view' permission to 'authenticated user' (be sure to uncheck 'acquire' box... for that permission) The redirection back to the page that invoked the authentication page will then be automatic. -- David Siedband Oceanic Sky New Media http://oceanicsky.com On Jun 17, 2004, at 2:19 AM, Martin Koekenberg wrote:
hello, I've a loginscreen (Session based User folder). In my index_html template is the folowing code : <dtml-if expr="AUTHENTICATED_USER.getUserName() == 'Anonymous User'"> <dtml-call expr="RESPONSE.redirect('/login', lock=1)"> </dtml-if> /login is the login page. But how can I automaticaly jump back (after a succesfull login) to de page that was requested before the loginscreen ? Example: I enter the site (http://beta.swol1894.nl). That page will forward me to the login. After a succesfull login I want a jump to the homepage. (That page send me to the login). Who know's a solution for this ? Greetings, Martin Koekenberg _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman-20/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman-20/listinfo/zope-announce http://mail.zope.org/mailman-20/listinfo/zope-dev )
participants (6)
-
David Siedband -
Martin Koekenberg -
Peter Bengtsson -
Roché Compaan -
Sven Hohage -
Terry Hancock