From f6ccdba595df8f2edb41f90ccba9807d4101ec81 Mon Sep 17 00:00:00 2001 From: Brady Miller Date: Thu, 5 Jan 2017 02:03:16 -0800 Subject: [PATCH] Logout fix. (#420) This is to prevent following logout bug: 1. Login to OpenEMR. 2. Go to Patient Flow Board and toggle on Open Patient in New Window. 3. A new window(OpenEMR instance) now opens up. 4. Click to logout of the new OpenEMR instance. Because of code in library/auth.inc, the following bugs happen: 1. The window of the OpenEMR instance that you clicked to logout will go away. 2. The Original window (from step 2 above) will then logout. This is because the 'opener' javascript variable is linked to the original instance. The fix is to always set the 'opener' variable to null in the main script for frames (interface/main/main_screen.php) and tabs (interface/main/tabs/main.php). --- interface/main/main_screen.php | 5 +++++ interface/main/tabs/main.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/interface/main/main_screen.php b/interface/main/main_screen.php index 39553cf9e..5648671e2 100644 --- a/interface/main/main_screen.php +++ b/interface/main/main_screen.php @@ -139,6 +139,11 @@ var tab_mode=false; +// Since this should be the parent window, this is to prevent calls to the +// window that opened this window. For example when a new window is opened +// from the Patient Flow Board or the Patient Finder. +window.opener = null; + // This flag indicates if another window or frame is trying to reload the login // page to this top-level window. It is set by javascript returned by auth.inc // and is checked by handlers of beforeunload events. diff --git a/interface/main/tabs/main.php b/interface/main/tabs/main.php index 14097e709..4a39d753c 100644 --- a/interface/main/tabs/main.php +++ b/interface/main/tabs/main.php @@ -38,6 +38,11 @@ $esignApi = new Api();