Fix logging out after session timeout.
authorJan Schneider <jan@horde.org>
Mon, 31 May 2010 15:24:03 +0000 (17:24 +0200)
committerJan Schneider <jan@horde.org>
Mon, 31 May 2010 16:22:33 +0000 (18:22 +0200)
horde/services/ajax.php

index e1531c2..eb9756c 100644 (file)
@@ -34,16 +34,17 @@ if (empty($action)) {
 try {
     Horde_Registry::appInit($app, array('authentication' => 'throw'));
 } catch (Horde_Exception $e) {
-    /* Handle session timeouts when they come from an AJAX request. */
-    if (($e->getCode() == Horde_Registry::AUTH_FAILURE) &&
-        ($action != 'logOut')) {
-        $ajax = Horde_Ajax::getInstance($app);
-        $GLOBALS['notification']->push(str_replace('&amp;', '&', Horde_Auth::getLogoutUrl(array('reason' => Horde_Auth::REASON_SESSION))), 'horde.ajaxtimeout', array('content.raw'));
-        Horde::sendHTTPResponse(Horde::prepareResponse(null, $ajax->notify), $ajax->responseType());
-        exit;
-    }
+    if ($action != 'logOut') {
+        /* Handle session timeouts when they come from an AJAX request. */
+        if ($e->getCode() == Horde_Registry::AUTH_FAILURE) {
+            $ajax = Horde_Ajax::getInstance($app);
+            $GLOBALS['notification']->push(str_replace('&amp;', '&', Horde_Auth::getLogoutUrl(array('reason' => Horde_Auth::REASON_SESSION))), 'horde.ajaxtimeout', array('content.raw'));
+            Horde::sendHTTPResponse(Horde::prepareResponse(null, $ajax->notify), $ajax->responseType());
+            exit;
+        }
 
-    Horde_Auth::authenticateFailure($app, $e);
+        Horde_Auth::authenticateFailure($app, $e);
+    }
 }
 
 // Open an output buffer to ensure that we catch errors that might break JSON