diff --git a/cake/libs/controller/components/auth.php b/cake/libs/controller/components/auth.php index a8744ce25..a638fd567 100644 --- a/cake/libs/controller/components/auth.php +++ b/cake/libs/controller/components/auth.php @@ -339,7 +339,7 @@ class AuthComponent extends Object { $this->Session->setFlash($this->authError, 'default', array(), 'auth'); if (!empty($controller->params['url']) && count($controller->params['url']) >= 2) { $query = $controller->params['url']; - unset($query['url']); + unset($query['url'], $query['ext']); $url .= Router::queryString($query, array()); } $this->Session->write('Auth.redirect', $url); diff --git a/cake/tests/cases/libs/controller/components/auth.test.php b/cake/tests/cases/libs/controller/components/auth.test.php index 3cdb25bb7..00bf8a9c6 100644 --- a/cake/tests/cases/libs/controller/components/auth.test.php +++ b/cake/tests/cases/libs/controller/components/auth.test.php @@ -728,6 +728,7 @@ class AuthTest extends CakeTestCase { $this->Controller->params['action'] = 'Add'; $this->assertFalse($this->Controller->Auth->startup($this->Controller)); } + /** * testLoginRedirect method * @@ -854,6 +855,22 @@ class AuthTest extends CakeTestCase { $this->Controller->Auth->startup($this->Controller); $expected = Router::normalize('posts/index/29?print=true&refer=menu'); $this->assertEqual($expected, $this->Controller->Session->read('Auth.redirect')); + + $_GET = array( + 'url' => '/posts/index/29', + 'print' => 'true', + 'refer' => 'menu', + 'ext' => 'html' + ); + $this->Controller->Session->del('Auth'); + $url = '/posts/index/29?print=true&refer=menu'; + $this->Controller->params = Dispatcher::parseParams($url); + $this->Controller->Auth->initialize($this->Controller); + $this->Controller->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login'); + $this->Controller->Auth->userModel = 'AuthUser'; + $this->Controller->Auth->startup($this->Controller); + $expected = Router::normalize('posts/index/29?print=true&refer=menu'); + $this->assertEqual($expected, $this->Controller->Session->read('Auth.redirect')); $_GET = $_back; //external authed action