Add special case for login redirection
This commit is contained in:
parent
bc1e47d6e5
commit
e2ec8af47b
@ -60,7 +60,16 @@ final class Session
|
|||||||
public static function login_or_die()
|
public static function login_or_die()
|
||||||
{
|
{
|
||||||
if (!self::is_login()) {
|
if (!self::is_login()) {
|
||||||
header("Location: /user/login?return_uri=".$_SERVER["REQUEST_URI"]);
|
$S_uri = null;
|
||||||
|
|
||||||
|
// special case: user probably got there from the account button
|
||||||
|
if (str_starts_with($_SERVER["REQUEST_URI"], "/user/") && isset($_SERVER["HTTP_REFERER"])) {
|
||||||
|
$S_uri = $_SERVER['HTTP_REFERER'];
|
||||||
|
} else {
|
||||||
|
$S_uri = $_SERVER["REQUEST_URI"];
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Location: /user/login?return_uri=".$S_uri);
|
||||||
throw new HTTPSpecialCaseException(403);
|
throw new HTTPSpecialCaseException(403);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user