Delete session cookie when session is expired

When the session is expired and we show the dialog box telling the
user their session is dead, delete the cookie if they click "Close".
This way they can at least continue to use the browser session and
not receive futher error dialogs.

Bug: issue 385
Change-Id: I4eccf39bba693dd4b0ad63aa0887511d7929ec52
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2010-01-14 09:48:09 -08:00
parent c3d615eae9
commit 48bc519a98
2 changed files with 9 additions and 1 deletions

View File

@@ -65,6 +65,7 @@ public class Gerrit implements EntryPoint {
public static final GerritResources RESOURCES =
GWT.create(GerritResources.class);
public static final SystemInfoService SYSTEM_SVC;
private static final String SESSION_COOKIE = "GerritAccount";
private static String myHost;
private static GerritConfig myConfig;
@@ -193,6 +194,12 @@ public class Gerrit implements EntryPoint {
}
}
static void deleteSessionCookie() {
Cookies.removeCookie(SESSION_COOKIE);
myAccount = null;
refreshMenuBar();
}
public void onModuleLoad() {
UserAgent.assertNotInIFrame();
@@ -271,7 +278,7 @@ public class Gerrit implements EntryPoint {
JsonUtil.setDefaultXsrfManager(new XsrfManager() {
@Override
public String getToken(JsonDefTarget proxy) {
return Cookies.getCookie("GerritAccount");
return Cookies.getCookie(SESSION_COOKIE);
}
@Override

View File

@@ -48,6 +48,7 @@ public class NotSignedInDialog extends AutoCenterDialogBox {
close.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Gerrit.deleteSessionCookie();
hide();
}
});