Fixing URL normalization for AuthComponent redirects

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4663 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-03-23 16:46:19 +00:00
parent 88563ebe46
commit 1bf81bbee9

View file

@ -282,7 +282,7 @@ class AuthComponent extends Object {
if (!$this->user()) { if (!$this->user()) {
if (!$this->RequestHandler->isAjax()) { if (!$this->RequestHandler->isAjax()) {
$this->Session->write('Auth.redirect', $url); $this->Session->write('Auth.redirect', $url);
$controller->redirect('/' . $this->loginAction); $controller->redirect($this->_normalizeURL($this->loginAction));
} elseif (!empty($this->ajaxLogin)) { } elseif (!empty($this->ajaxLogin)) {
$controller->viewPath = 'elements'; $controller->viewPath = 'elements';
$controller->render($this->ajaxLogin, 'ajax'); $controller->render($this->ajaxLogin, 'ajax');
@ -533,13 +533,13 @@ class AuthComponent extends Object {
$redir = $this->Session->read('Auth.redirect'); $redir = $this->Session->read('Auth.redirect');
$this->Session->delete('Auth.redirect'); $this->Session->delete('Auth.redirect');
if ($this->_normalizeURL('/' . $redir) == $this->_normalizeURL($this->loginAction)) { if ($this->_normalizeURL($redir) == $this->_normalizeURL($this->loginAction)) {
$redir = $this->loginRedirect; $redir = $this->loginRedirect;
} }
} else { } else {
$redir = $this->loginRedirect; $redir = $this->loginRedirect;
} }
return $this->_normalizeURL('/' . $redir); return $this->_normalizeURL($redir);
} }
/** /**
* Validates a user against an abstract object. * Validates a user against an abstract object.