diff --git a/bootstrap.php b/bootstrap.php index a82796ebd2d7ecba1eb453884502f10a193ded53..9a66c5a071f74554a7c827fa17f8f279ea14dfb5 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -48,6 +48,20 @@ class Bootstrap { $_SERVER['REMOTE_ADDR'] = ''; } + /* + * Glue to global signals we're interested in + */ + static function signals() { + + //Clear upgrader session on logout. + Signal::connect('auth.logout', function ($user, $data=null) { + if (!$user) return; + + if ($user instanceof Staff) + $_SESSION['ost_upgrader'] = null; + }); + } + function https() { return (isset($_SERVER['HTTPS']) diff --git a/include/class.auth.php b/include/class.auth.php index c7c36c8e87354dc2c9508ab821369401dccf5131..054ccd9417112d2a5b4921ceea3d8680886554d4 100644 --- a/include/class.auth.php +++ b/include/class.auth.php @@ -303,6 +303,7 @@ abstract class StaffAuthenticationBackend extends AuthenticationBackend { $staff->getUserName(), $_SERVER['REMOTE_ADDR'])); //Debug. + Signal::send('auth.logout', $staff); } static function getUser() { diff --git a/main.inc.php b/main.inc.php index 7feb271e7743274b02b2227ac29e68f4e67f3f7e..8c6d3d337f20c1196feca63c7dfb490479fad7a3 100644 --- a/main.inc.php +++ b/main.inc.php @@ -26,6 +26,7 @@ Bootstrap::defineTables(TABLE_PREFIX); Bootstrap::i18n_prep(); Bootstrap::loadCode(); Bootstrap::connect(); +Bootstrap::signals(); if(!($ost=osTicket::start()) || !($cfg = $ost->getConfig())) Bootstrap::croak('Unable to load config info from DB. Get tech support.');