Re: How do I do a logout?
Re: How do I do a logout?
- Subject: Re: How do I do a logout?
- From: Art Isbell <email@hidden>
- Date: Thu, 18 Mar 2004 17:02:21 -1000
On Mar 18, 2004, at 4:23 PM, David Elsner wrote:
Bind a hyper link to this:
public LogOutPage logOut()
{
LogOutPage nextPage = (LogOutPage)pageWithName("LogOutPage");
((Session)session()).terminate();
return nextPage;
}
Dave
On 19/03/2004, at 12:01 PM, James Cicenia wrote:
Ok -
this has to be simple.. how do I logout correctly my user?
i.e. terminate session and redirect user to a login page?
It's been a while since I looked into this, but I don't think it's
that simple. When I last looked, returning a page via a component
action created a new session. So the above would terminate the current
session and start a new session. If that's what you want, fine, but I
wanted no session created until my sign in page (Main in my case) was
displayed. So this is what I ended up doing to avoid session creation:
public WORedirect signOut() {
WORedirect nextPageL = (WORedirect)pageWithName("WORedirect");
nextPageL.setUrl(context().directActionURLForActionNamed("signOutAction"
, null));
session().terminate();
return nextPageL;
}
And in DirectAction.java:
public WOActionResults signOutAction() {
return pageWithName("SignOut");
}
On my SignOut component, I have a link to my sign in page. Unless
you're careful, displaying your sign in page could create a new
session. Sessions are pesky things to avoid :-)
Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.