Re: How do I do a logout?
Re: How do I do a logout?
- Subject: Re: How do I do a logout?
- From: Robert Walker <email@hidden>
- Date: Thu, 18 Mar 2004 23:51:39 -0500
There is one "sure fire" way to prevent the creation of another
session. You could use the WORedirect to take you to a "static" web
page. You could then put a hyperlink on that page to get back to a
sign-in page. Probably not necessary, but would definitely avoid a new
session after logging out.
It is definitely true that if component request handling is used you
will immediately get a new session. The only solution I know of, as
explained previously, is to use a direct action to display a page that
has absolutely NO references to session. Also any reference to
session() within a direct action will obviously create a session if a
session ID is not available.
On Mar 18, 2004, at 10:02 PM, Art Isbell wrote:
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.
--
Sincerely,
Robert Walker
_______________________________________________
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.