Commit a248c335 by Tuukka Kivilahti

logout fix

1 parent 4f3d0e0e
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:login="http://java.sun.com/jsf/composite/cditools/login" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:login="http://java.sun.com/jsf/composite/cditools/login"
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:p="http://primefaces.org/ui"
> >
<composite:interface> <composite:interface>
...@@ -13,7 +13,12 @@ ...@@ -13,7 +13,12 @@
<composite:implementation> <composite:implementation>
<c:choose> <c:choose>
<c:when test='#{sessionHandler.isLoggedIn() }'> <c:when test='#{sessionHandler.isLoggedIn() }'>
<h:link value="#{i18n['login.logout']}" outcome="/auth/logout" /> <h:form>
<p:commandLink actionListener="#{authView.doLogout}" ajax="false">
<h:outputText value="#{i18n['login.logout']}" />
</p:commandLink>
</h:form>
</c:when> </c:when>
<c:otherwise> <c:otherwise>
<login:login isOneliner="true" /> <login:login isOneliner="true" />
......
...@@ -54,11 +54,25 @@ public class AuthView extends GenericCDIView { ...@@ -54,11 +54,25 @@ public class AuthView extends GenericCDIView {
} }
} }
req.getSession().invalidate(); req.getSession().invalidate();
navihandler.forward("logoutDone");
} }
public String doLogout() {
HttpServletRequest req = getRequest();
if (permbean.isLoggedIn()) {
try {
req.logout();
} catch (ServletException e) {
logger.warn("Error executing logout", e);
}
}
req.getSession().invalidate();
return "/index";
}
public void executeLogin() { public void executeLogin() {
executeLogin(null); executeLogin(null);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!