If we don't need authentication and have a target URL, redirect there.
authorJan <jan@horde.org>
Wed, 7 Jul 2010 16:10:32 +0000 (17:10 +0100)
committerJan Schneider <jan@horde.org>
Wed, 7 Jul 2010 16:26:34 +0000 (18:26 +0200)
horde/login.php

index 012d6e3..443b0c9 100644 (file)
@@ -233,10 +233,18 @@ if ($error_reason) {
 }
 
 /* If we currently are authenticated, and are not trying to authenticate to
- * an application, redirect to initial page. This is done in index.php. */
-if ($is_auth && !$vars->app) {
-    require HORDE_BASE . '/index.php';
-    exit;
+ * an application, redirect to initial page. This is done in index.php.
+ * If we are trying to authenticate to an application, but don't have to,
+ * redirect to the requesting URL. */
+if ($is_auth) {
+    if (!$vars->app) {
+        require HORDE_BASE . '/index.php';
+        exit;
+    } elseif ($url_in &&
+              $registry->isAuthenticated(array('app' => $vars->app))) {
+        header('Location: ' . _addAnchor($url_in, 'param', null, $url_anchor));
+        exit;
+    }
 }
 
 /* Redirect the user if an alternate login page has been specified. */