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

View File

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

View File

@ -27,10 +27,10 @@
$auth = new uAuth(); $auth = new uAuth();
if (!$auth->isAuthenticated() && $auth->isLoginAttempt()) { 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) { if (!$auth->isAuthenticated() && uConfig::$require_authentication) {
$auth->exitWithRedirect("/login.php"); $auth->exitWithRedirect("login.php");
} }