From ff7065e2b419819125bb52e68a6336d4ece3de75 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Tue, 20 Apr 2021 20:09:27 +0200 Subject: [PATCH] baculum: Fix #2592 logout button on Safari web browser --- .../protected/Web/Portlets/MainSideBar.tpl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gui/baculum/protected/Web/Portlets/MainSideBar.tpl b/gui/baculum/protected/Web/Portlets/MainSideBar.tpl index a37e2ffe7..ecdc236bd 100644 --- a/gui/baculum/protected/Web/Portlets/MainSideBar.tpl +++ b/gui/baculum/protected/Web/Portlets/MainSideBar.tpl @@ -14,10 +14,21 @@ ToolTip="<%[ Logout ]%>" > - if (!window.chrome || window.navigator.webdriver) { + if (!window.chrome && window.navigator.userAgent.indexOf('Safari') != -1) { + // Safari + var xml_http = new XMLHttpRequest(); + xml_http.open('POST', main_side_bar_reload_url, true, '<%=$this->User->getUsername()%>'); + xml_http.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + window.location.reload(); + } + } + xml_http.send(); + } else if (!window.chrome || window.navigator.webdriver) { + // Firefox and others window.location.href = main_side_bar_reload_url; } else if (window.chrome) { - // For chrome this reload is required to show login Basic auth prompt + // Chrome window.location.reload(); } -- 2.47.3