From 9e7793244f656abd8614bfed538d13d357e90627 Mon Sep 17 00:00:00 2001 From: Alex Bligh Date: Wed, 28 Nov 2012 19:32:26 +0000 Subject: [PATCH] Allow logout button to work where no Java app used Add global variable of SELF_CLOSE which can be used to close the window during a logout instead or redirecting the window to another page. Add the param selfclose=1 to the url to make it work --- src/main/webapp/client.xhtml | 2 ++ src/main/webapp/scripts/interface.js | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/client.xhtml b/src/main/webapp/client.xhtml index afec1b4..66d6184 100644 --- a/src/main/webapp/client.xhtml +++ b/src/main/webapp/client.xhtml @@ -128,6 +128,8 @@ var tunneltype = getParameter("tunnel"); var wsendpoint = getParameter("wsendpoint", "websocket-tunnel"); var httpendpoint = getParameter("httpendpoint", "tunnel"); + /* Should Window close on logout */ + window.SELF_CLOSE = getParameter("selfclose", 0); /* if 1 then the window will close on logout if 0 then the logout will redirect, defaults to 0 */ switch (tunneltype) { case 'http': diff --git a/src/main/webapp/scripts/interface.js b/src/main/webapp/scripts/interface.js index 45f6590..824219e 100644 --- a/src/main/webapp/scripts/interface.js +++ b/src/main/webapp/scripts/interface.js @@ -315,8 +315,12 @@ var GuacamoleUI = { // Logout after warning user about session disconnect if (confirm(GuacamoleUI.LOGOUT_PROMPT)) { - window.location.href = "logout"; - GuacamoleUI.hideTouchMenu(); + if(1 == window.SELF_CLOSE){ + window.close(); + }else{ + window.location.href = "logout"; + GuacamoleUI.hideTouchMenu(); + } } }; -- 1.7.10.4