From: Marcin Haba Date: Tue, 20 Apr 2021 18:09:27 +0000 (+0200) Subject: baculum: Fix #2592 logout button on Safari web browser X-Git-Tag: Release-11.0.3~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff7065e2b419819125bb52e68a6336d4ece3de75;p=thirdparty%2Fbacula.git baculum: Fix #2592 logout button on Safari web browser --- 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(); }