Issue #9040 - Auth saving json in Auth.redirect

AuthComponent is storing JSON or any other AJAX request URL into the session variable Auth.redirect used for login redirect if the AJAX request does not send the X-Requested-With:XMLHttpRequest header.

If you send an ajax request without that header and your request is not a (.json) it will store the URL anyway.
This commit is contained in:
Iñigo In The Cloud 2016-06-27 14:15:05 -04:00 committed by GitHub
parent 92a50d05dc
commit 2c112095a9

View file

@ -359,7 +359,7 @@ class AuthComponent extends Component {
return true;
}
if (!$controller->request->is('ajax')) {
if (!$controller->request->is('ajax') && !$controller->request->is('json')) {
$this->flash($this->authError);
$this->Session->write('Auth.redirect', $controller->request->here(false));
$controller->redirect($this->loginAction);