Fixing lost querystring params when user request without a session is performed. Test case updated. Fixes #6211

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8156 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2009-04-25 02:16:05 +00:00
parent 8bb11e49d7
commit b68c78fc0f
2 changed files with 6 additions and 1 deletions

View file

@ -337,6 +337,11 @@ class AuthComponent extends Object {
if (!$this->user()) {
if (!$this->RequestHandler->isAjax()) {
$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']);
$url .= Router::queryString($query, array());
}
$this->Session->write('Auth.redirect', $url);
$controller->redirect($loginAction);
return false;

View file

@ -841,7 +841,7 @@ class AuthTest extends CakeTestCase {
// QueryString parameters
$_back = $_GET;
$_GET = array(
'url' => '/posts/index/29?print=true&refer=menu',
'url' => '/posts/index/29',
'print' => 'true',
'refer' => 'menu'
);