Skip to content

Commit

Permalink
Fixing default/fallback url when no referrer is set.
Browse files Browse the repository at this point in the history
Fixes #1761
  • Loading branch information
markstory committed Jun 10, 2011
1 parent 71e2c8e commit 182a89b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/Controller/Component/AuthComponent.php
Expand Up @@ -329,7 +329,7 @@ public function startup($controller) {
}

$this->flash($this->authError);
$controller->redirect($controller->referer(), null, true);
$controller->redirect($controller->referer('/'), null, true);
return false;
}

Expand Down

4 comments on commit 182a89b

@ceeram
Copy link
Contributor

@ceeram ceeram commented on 182a89b Jun 10, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt referer() already fallback to '/' when no referer can be read from header, i think $default only needs to be set when you want another default url then '/'
so shouldn't we focus on why referer() without $default doesnt return '/' for ticket #1761

@markstory
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current default for controller::referer() is null, but it does look like there might be a way in CakeRequest to get an empty value out of CakeRequest::referer(). The tests seem to indicate otherwise though. I think you're right though that there might be a problem somewhere else.

@renan
Copy link
Contributor

@renan renan commented on 182a89b Jun 10, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $default is null, but the default return is '/'.
https://github.com/cakephp/cakephp/blob/2.0/lib/Cake/Controller/Controller.php#L884

Does that mean if there is no referer and no $default it would return '/'?
Even CakeRequest::referer() returns '/' by default.

@ceeram
Copy link
Contributor

@ceeram ceeram commented on 182a89b Jun 10, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default returned '/' when $default = null, is what i meant, hence i said focus on why this occurs for ticket #1761

Please sign in to comment.