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:
@@ -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
|
||||
|
||||
@@ -48,6 +48,7 @@ public class NotSignedInDialog extends AutoCenterDialogBox {
|
||||
close.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Gerrit.deleteSessionCookie();
|
||||
hide();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user