Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

As a User I want to be able to logout and clear my cookies

  • Loading branch information...
commit d9b35803ea0321dc5e80f80d480a6af527a457fa 1 parent 59cb50d
Tomasz Dziurko authored September 14, 2012
10  src/main/java/pl/tomaszdziurko/wicket/view/HomePage.java
@@ -6,6 +6,9 @@
6 6
 import org.apache.wicket.markup.html.panel.FeedbackPanel;
7 7
 import org.apache.wicket.request.mapper.parameter.PageParameters;
8 8
 import pl.tomaszdziurko.wicket.UserSession;
  9
+import pl.tomaszdziurko.wicket.WicketApplication;
  10
+import pl.tomaszdziurko.wicket.service.CookieService;
  11
+import pl.tomaszdziurko.wicket.service.SessionProvider;
9 12
 
10 13
 public class HomePage extends BasePage {
11 14
     private static final long serialVersionUID = 1L;
@@ -18,7 +21,12 @@ public HomePage(final PageParameters parameters) {
18 21
         Link<Void> logoutLink = new Link<Void>("logout") {
19 22
             @Override
20 23
             public void onClick() {
21  
-                UserSession.get().invalidateNow();
  24
+                CookieService cookieService = WicketApplication.get().getCookieService();
  25
+                cookieService.removeCookieIfPresent(getRequest(), getResponse(), SessionProvider.REMEMBER_ME_LOGIN_COOKIE);
  26
+                cookieService.removeCookieIfPresent(getRequest(), getResponse(), SessionProvider.REMEMBER_ME_PASSWORD_COOKIE);
  27
+
  28
+                UserSession.get().setUser(null);
  29
+                UserSession.get().invalidate();
22 30
             }
23 31
         };
24 32
         logoutLink.setVisible(UserSession.get().userLoggedIn());

0 notes on commit d9b3580

Please sign in to comment.
Something went wrong with that request. Please try again.