Fix regression with browser redirection

This commit is contained in:
Bartek Fabiszewski 2018-01-31 10:11:56 +01:00
parent 153a174930
commit ed05a9f96c
3 changed files with 6 additions and 5 deletions

View File

@ -142,7 +142,7 @@
/**
* Log out with redirect
*
* @param string $path URL path
* @param string $path URL path (without leading slash)
* @return void
*/
public function logOutWithRedirect($path = "") {
@ -173,11 +173,11 @@
/**
* Redirect browser and exit
*
* @param string $path Redirect URL path
* @param string $path Redirect URL path (without leading slash)
* @return void
*/
public function exitWithRedirect($path = "") {
$location = str_replace("//", "/", BASE_URL . $path);
$location = BASE_URL . $path;
header("Location: $location");
exit();
}

View File

@ -110,6 +110,7 @@
/**
* Calculate app base URL
* Returned URL has trailing slash.
*
* @return string URL
*/

View File

@ -27,10 +27,10 @@
$auth = new uAuth();
if (!$auth->isAuthenticated() && $auth->isLoginAttempt()) {
$auth->exitWithRedirect("/login.php?auth_error=1");
$auth->exitWithRedirect("login.php?auth_error=1");
}
if (!$auth->isAuthenticated() && uConfig::$require_authentication) {
$auth->exitWithRedirect("/login.php");
$auth->exitWithRedirect("login.php");
}