diff --git a/build/index.php b/build/index.php index 3ebdc2c..ecc57d2 100644 --- a/build/index.php +++ b/build/index.php @@ -1158,7 +1158,7 @@ if(!isset($pageindex->{$env->page}) and isset($_GET["search-redirect"])) // Note we use $_GET here because $env->action isn't populated at this point if($settings->require_login_view === true && // If this site requires a login in order to view pages !$env->is_logged_in && // And the user isn't logged in - $_GET["action"] !== "login") // And the user isn't requesting the login page + !in_array($_GET["action"], [ "login", "checklogin" ])) // And the user isn't trying to login { // Redirect the user to the login page http_response_code(307); @@ -2854,13 +2854,19 @@ register_module([ */ add_action("login", function() { global $settings; + + // Build the action url that will actually perform the login + $login_form_action_url = "index.php?action=checklogin"; + if(isset($_GET["returnto"])) + $login_form_action_url .= "&returnto=" . rawurlencode($_GET["returnto"]); + $title = "Login to $settings->sitename"; $content = "
Login failed.
\n"; if(isset($_GET["required"])) $content .= "\t\t$settings->sitename requires that you login before continuing.
\n"; - $content .= "\t\t