Skip to content

Commit

Permalink
Fixing lost querystring params when user request without a session is…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
markstory committed Apr 25, 2009
1 parent 8bb11e4 commit b68c78f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cake/libs/controller/components/auth.php
Expand Up @@ -337,6 +337,11 @@ function startup(&$controller) {
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;
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/controller/components/auth.test.php
Expand Up @@ -841,7 +841,7 @@ function testLoginRedirect() {
// QueryString parameters
$_back = $_GET;
$_GET = array(
'url' => '/posts/index/29?print=true&refer=menu',
'url' => '/posts/index/29',
'print' => 'true',
'refer' => 'menu'
);
Expand Down

0 comments on commit b68c78f

Please sign in to comment.