mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-09 04:52:42 +00:00
Rebalance where URL normalization happens in AuthComponent.
Make URL's not include the base path when storing them in the session. This makes future redirection simpler. When URL's are an array use Router::url() on them. Fixes #3916
This commit is contained in:
parent
e016f1156f
commit
d40c7376ce
1 changed files with 5 additions and 3 deletions
|
@ -307,7 +307,6 @@ class AuthComponent extends Component {
|
|||
if ($loginAction != $url && in_array($action, array_map('strtolower', $this->allowedActions))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($loginAction == $url) {
|
||||
if (empty($request->data)) {
|
||||
if (!$this->Session->check('Auth.redirect') && env('HTTP_REFERER')) {
|
||||
|
@ -321,7 +320,7 @@ class AuthComponent extends Component {
|
|||
if (!$this->_getUser()) {
|
||||
if (!$request->is('ajax')) {
|
||||
$this->flash($this->authError);
|
||||
$this->Session->write('Auth.redirect', $request->here());
|
||||
$this->Session->write('Auth.redirect', $request->here(false));
|
||||
$controller->redirect($loginAction);
|
||||
return false;
|
||||
}
|
||||
|
@ -677,7 +676,10 @@ class AuthComponent extends Component {
|
|||
} else {
|
||||
$redir = '/';
|
||||
}
|
||||
return Router::normalize($redir, false);
|
||||
if (is_array($redir)) {
|
||||
return Router::url($redir);
|
||||
}
|
||||
return $redir;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue