public WORedirect homeButton() {
if (context().session() != null) {
if (((Session)session()).authenticatedUser() != null) {
((Session)session()).setAuthenticatedUser(null);
session().terminate();
}
}
String url = "">"default", null);
url = "">"&", "&");
WORedirect redirect = new WORedirect(context());
redirect.setUrl(url);
return redirect;
This works as long as the session being tested for null has not timed out. This bit of code is in a component at the top of every one of my pages. It controls what happens is a user is logged in. If that particular user in the session is logged in, I want them to automatically be logged out and sent to their intended destination where as here the destination is the home screen. The problem I am having is that when the session times out while the user is still logged in, the button takes them to the session timed out page.
What I want to do:
* When the WORedirect is called, I want the first if statement to test whether there is an active session. If there is, then I want to set the authenticated user to null, terminate the current session if there was a user authenticated, and then redirect them back to the default page.
* If there is not an active session, I want to skip everything about the user, create a session, and redirect to the default page.
* I don't ever want the user to see any kind of 'session timed out' page.
How could I go about doing this?
Thanks,
Awbrey