Skip to content
Permalink
Browse files

Strips the base off the generated URL from the AuthComponent.

Fixes #3922.
  • Loading branch information...
Phally committed Jul 26, 2013
1 parent 8b21710 commit f7eab23a5c03b4f323e1445e3129b54da56793d3
@@ -677,7 +677,7 @@ public function redirectUrl($url = null) {
$redir = '/';
}
if (is_array($redir)) {
return Router::url($redir);
return Router::url($redir + array('base' => false));
}
return $redir;
}
@@ -1268,6 +1268,41 @@ public function testRedirectSessionReadEqualToLoginAction() {
$this->assertFalse($this->Auth->Session->check('Auth.redirect'));
}
/**
* test that the returned URL doesn't contain the base URL.
*
* @see https://cakephp.lighthouseapp.com/projects/42648/tickets/3922-authcomponentredirecturl-prepends-appbaseurl
*
* @return void This test method doesn't return anything.
*/
public function testRedirectUrlWithBaseSet() {
$App = Configure::read('App');
Configure::write('App', array(
'dir' => APP_DIR,
'webroot' => WEBROOT_DIR,
'base' => false,
'baseUrl' => '/cake/index.php'
));
$url = '/users/login';
$this->Auth->request = $this->Controller->request = new CakeRequest($url);
$this->Auth->request->addParams(Router::parse($url));
$this->Auth->request->url = Router::normalize($url);
Router::setRequestInfo($this->Auth->request);
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'home');
$result = $this->Auth->redirectUrl();
$this->assertEquals('/users/home', $result);
$this->assertFalse($this->Auth->Session->check('Auth.redirect'));
Configure::write('App', $App);
Router::reload();
}
/**
* test password hashing
*

0 comments on commit f7eab23

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.