Permalink
Browse files

Fixing default/fallback url when no referrer is set.

Fixes #1761
  • Loading branch information...
markstory committed Jun 10, 2011
1 parent 71e2c8e commit 182a89b0a05527e0a727993764ce77cde37f412b
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Cake/Controller/Component/AuthComponent.php
@@ -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;
}

4 comments on commit 182a89b

@ceeram

This comment has been minimized.

Show comment Hide comment
@ceeram

ceeram Jun 10, 2011

Member

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

Member

ceeram replied Jun 10, 2011

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

This comment has been minimized.

Show comment Hide comment
@markstory

markstory Jun 10, 2011

Owner

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.

Owner

markstory replied Jun 10, 2011

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

This comment has been minimized.

Show comment Hide comment
@renan

renan Jun 10, 2011

Member

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.

Member

renan replied Jun 10, 2011

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

This comment has been minimized.

Show comment Hide comment
@ceeram

ceeram Jun 10, 2011

Member

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

Member

ceeram replied Jun 10, 2011

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.