Skip to content

Commit

Permalink
Update AuthComponent to not strip when normalizing URLs.
Browse files Browse the repository at this point in the history
Revert most of the changes done to fix #3897 originally and try
a different strategy of solving the base path issues and not breaking
apps running in a subdirectory.

Fixes #3916
  • Loading branch information
markstory committed Jul 13, 2013
1 parent 52be365 commit 8133f72
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Cake/Controller/Component/AuthComponent.php
Expand Up @@ -311,7 +311,8 @@ public function startup(Controller $controller) {
if ($loginAction == $url) {
if (empty($request->data)) {
if (!$this->Session->check('Auth.redirect') && env('HTTP_REFERER')) {
$this->Session->write('Auth.redirect', $controller->referer(null, true));
$referer = $request->referer(true);
$this->Session->write('Auth.redirect', $referer);
}
}
return true;
Expand Down Expand Up @@ -666,7 +667,6 @@ public function redirectUrl($url = null) {
$this->Session->write('Auth.redirect', $redir);
} elseif ($this->Session->check('Auth.redirect')) {
$redir = $this->Session->read('Auth.redirect');
$redir = is_string($redir) ? ltrim($redir, '/') : $redir;
$this->Session->delete('Auth.redirect');

if (Router::normalize($redir) == Router::normalize($this->loginAction)) {
Expand All @@ -677,7 +677,7 @@ public function redirectUrl($url = null) {
} else {
$redir = '/';
}
return Router::normalize($redir);
return Router::normalize($redir, false);
}

/**
Expand Down

0 comments on commit 8133f72

Please sign in to comment.