]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Fix #2592 logout button on Safari web browser
authorMarcin Haba <marcin.haba@bacula.pl>
Tue, 20 Apr 2021 18:09:27 +0000 (20:09 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Tue, 20 Apr 2021 18:09:27 +0000 (20:09 +0200)
gui/baculum/protected/Web/Portlets/MainSideBar.tpl

index a37e2ffe76b4785cdec5e2d4675ec8f01c6a19a4..ecdc236bd3be7b09b494250b7ffcacff7eedf61e 100644 (file)
                                ToolTip="<%[ Logout ]%>"
                        >
                                <prop:ClientSide.OnComplete>
-                                       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();
                                        }
                                </prop:ClientSide.OnComplete>