Hi Matt,
This works well for me. I have a secure screen and in isAutorized() I do
something like this:
if (user != null && user.hasLoggedIn())
{
doBuildSecureTemplate (data,context);
}
else
{
try
{
data.setMessage("invalid_login");
DynamicURI lastUrl = new DynamicURI (data);
lastUrl.addPathInfo (data.getParameters());
lastUrl.addPathInfo
("template",data.getTemplateInfo().getScreenTemplate());
context.put("oldurl",lastUrl);
data.getTemplateInfo().setScreenTemplate("Login.vm");
}
catch (Exception e)
{
Log.error (e);
}
return;
}
In my login screen I simply use something like this:
#if($oldurl)
action="$oldurl.setAction("LoginUser")"
#else
action="$link.setPage("Index.vm").setAction("LoginUser")"
#end
This works pretty cool because any screen that requires a login will go to
the login screen if your are not logged in and return to the right screen
when you have successfully logged in without any extra logic.
Hope it helps.
~ Leon
----- Original Message -----
From: "Matthew Forder" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 29, 2001 1:41 PM
Subject: Smart Login..?
> First of all, I just wanted to thank everyone who has taken the time to
> answer my (dumb!) questions over the last few weeks. As a new developer
> using both Java and Turbine for the first time I've found your responses
> very helpfull!
>
> And now, the real reason for this mail...
>
> I want to be able to include http links to secure pages in the emails to
> users. The problem is that if the user is not already authenticated
> he/she will be prompted to login (which is fine) but once the login is
> accomplised the Index.vm page is loaded instead of the link that was
> included in the email. Is there a way to use the standard LoginUser
> module and get it to "remember" where it should be going, or must I go
> and extend (or re-write) the LoginUser action to do this?
>
> Regards,
>
> Matt
>
> --
> ____ | Matthew J. Forder | Data Center Supervisor
> / / () | Seagate Techology | Tel:+31 20 316 7468
> \ \ \ | Koolhovenlaan 1 | Fax:+31 20 653 5537
> ()_/_/ | 1119 NB Schiphol-Rijk, NL | [EMAIL PROTECTED]
>
>
>
----------------------------------------------------------------------------
----
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]