From d40c7376cebaec118221f2c0582c97260e977e68 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 12 Jul 2013 21:40:38 -0400 Subject: [PATCH] Rebalance where URL normalization happens in AuthComponent. 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 --- lib/Cake/Controller/Component/AuthComponent.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index 7b49ed55c43..833b5f40f08 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -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')) { @@ -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; } @@ -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; } /**