Skip to content

Commit

Permalink
Rebalance where URL normalization happens in AuthComponent.
Browse files Browse the repository at this point in the history
Make URL's not include the base path when storing them in the session.
This makes future redirection simpler. When URL's are an array use
Router::url() on them.

Fixes #3916
  • Loading branch information
markstory committed Jul 13, 2013
1 parent e016f11 commit d40c737
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Cake/Controller/Component/AuthComponent.php
Expand Up @@ -307,7 +307,6 @@ public function startup(Controller $controller) {
if ($loginAction != $url && in_array($action, array_map('strtolower', $this->allowedActions))) {
return true;
}

if ($loginAction == $url) {
if (empty($request->data)) {
if (!$this->Session->check('Auth.redirect') && env('HTTP_REFERER')) {
Expand All @@ -321,7 +320,7 @@ public function startup(Controller $controller) {
if (!$this->_getUser()) {
if (!$request->is('ajax')) {
$this->flash($this->authError);
$this->Session->write('Auth.redirect', $request->here());
$this->Session->write('Auth.redirect', $request->here(false));
$controller->redirect($loginAction);
return false;
}
Expand Down Expand Up @@ -677,7 +676,10 @@ public function redirectUrl($url = null) {
} else {
$redir = '/';
}
return Router::normalize($redir, false);
if (is_array($redir)) {
return Router::url($redir);
}
return $redir;
}

/**
Expand Down

0 comments on commit d40c737

Please sign in to comment.