mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Ensuring that 'ext' param added by RequestHandler does not end up as a queryString parameter in Auth.redirect.
Adding test case. Fixes #6211 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8182 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
50f4d91873
commit
9aa64ef564
2 changed files with 18 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue