Skip to content

Commit

Permalink
CFM-160_Registry_PE_Should_Not_Assume_Installation_at_/registry-pe
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis authored Apr 6, 2022
1 parent 2863dbd commit fe8bb14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 5 additions & 3 deletions app/webroot/auth/login/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
}

$_SESSION['Auth']['external']['user'] = $_SERVER['REMOTE_USER'];
$target = $_SESSION['Auth']['target'] ?? "/";

$target = !empty($_SESSION['Auth']['target']) ? $_SESSION['Auth']['target'] : "/";
$re = '/(.*)\/auth\/login\/login(?:.php)?(.*)/m';
$subst = '$1' . $target . '$2';
$path = preg_replace($re, $subst, urldecode($_SERVER['REQUEST_URI']), 1);

// XXX fix hardcoded prefix?
header("Location: /registry-pe" . $target);
header("Location: " . $path);
6 changes: 5 additions & 1 deletion app/webroot/auth/logout/logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@

unset($_SESSION['Auth']);

header("Location: " . "/registry-pe");
$re = '/(.*)\/auth\/logout\/logout(?:.php)?(.*)/m';
$subst = '$1$2';
$path = preg_replace($re, $subst, urldecode($_SERVER['REQUEST_URI']), 1);

header("Location: " . $path);

0 comments on commit fe8bb14

Please sign in to comment.