diff --git a/web/index.php b/web/index.php index a91c59ce2..8f79ce6c0 100644 --- a/web/index.php +++ b/web/index.php @@ -147,7 +147,18 @@ else Fatal( "View '$view' does not exist" ); require_once $includeFile; } + // If the view overrides $view to 'error', and the user is not logged in, then the + // issue is probably resolvable by logging in, so provide the opportunity to do so. + // The login view should handle redirecting to the correct location afterward. + if ( $view == 'error' && !isset($user) ) + { + $view = 'login'; + foreach ( getSkinIncludes( 'views/login.php', true, true ) as $includeFile ) + require_once $includeFile; + } } + // If the view is missing or the view still returned error with the user logged in, + // then it is not recoverable. if ( !$includeFiles || $view == 'error' ) { foreach ( getSkinIncludes( 'views/error.php', true, true ) as $includeFile ) diff --git a/web/skins/classic/views/js/Makefile.am b/web/skins/classic/views/js/Makefile.am index ba1845e0c..a06927367 100644 --- a/web/skins/classic/views/js/Makefile.am +++ b/web/skins/classic/views/js/Makefile.am @@ -33,7 +33,7 @@ dist_web_DATA = \ montage.js \ montage.js.php \ options.js.php \ - postlogin.js \ + postlogin.js.php \ state.js \ state.js.php \ timeline.js \ diff --git a/web/skins/classic/views/js/postlogin.js b/web/skins/classic/views/js/postlogin.js deleted file mode 100644 index 06033187c..000000000 --- a/web/skins/classic/views/js/postlogin.js +++ /dev/null @@ -1 +0,0 @@ -(function () { window.location.replace( thisUrl ); }).delay( 500 ); diff --git a/web/skins/classic/views/js/postlogin.js.php b/web/skins/classic/views/js/postlogin.js.php new file mode 100644 index 000000000..fea68ec70 --- /dev/null +++ b/web/skins/classic/views/js/postlogin.js.php @@ -0,0 +1,23 @@ + + +( + function () + { + // Append '?(GET query)' to URL if the GET query is not empty. + var querySuffix = ""; + + var newUrl = thisUrl + querySuffix; + window.location.replace(newUrl); + } +).delay( 500 ); diff --git a/web/skins/classic/views/login.php b/web/skins/classic/views/login.php index a322ab663..a7562e5fa 100644 --- a/web/skins/classic/views/login.php +++ b/web/skins/classic/views/login.php @@ -29,6 +29,7 @@ xhtmlHeaders(__FILE__, $SLANG['Login'] );
+