php - Cakephp Auth Redirect out of Ajax -
so working on ajax based application. when sessions timesout, user gets redirected users/login in ajax itself... have user redirected different layout.
i have tried followings, none of them work...
return $this->redirect(array('ajax' => false, 'controller'=>'users','action'=>'login')); $this->auth->logoutredirect = '/';
i set $this->autorender = false;
, none of works.
what best way have user redirected out of ajax on session timeout?
i have in appcontroller.
if( $this->auth->loggedin() !== true && $this->params['action'] !== 'login'){ $this->autorender = false; return $this->redirect('/'); }
what need render proper response client, not redirect ajax request.
only redirecting current ajax request not stop client doing more requests. instead of redirecting it, should - ajax requests - return value client knows interpret signout.
if load ajax request directly div (for inclusion dom tree) can return javascript redirects user:
<script> window.location = "<signout/signin>.php" </script>
Comments
Post a Comment