We have this is a problem, too. Last Romel's solution sounds pretty good.
I would like though that this can be the default behavior (ex: putting it
in AppController::beforeFilter). But I want that all the actions specified
by $this->Auth->allow(...) do not to emit the {"login":true}One option is to call $this->Auth->allow(...) before parent::beforeFilter() in the derived controllers and having something (?) that tells if the current action is in the allow list. However an optional solution should be able to work even if parent::beforeFilter() is called before Auth->allow. Should not this be a feature of the AuthComponent? Best, Chris On Fri, Aug 31, 2012 at 6:02 AM, romel javier gomez herrera < [email protected]> wrote: > hi > > http://book.cakephp.org/1.3/en/view/967/isAjax > > <?php class AppController extends Controller { > > public function beforeFilter(){ > if ($this->Auth->User()){ > }else{ > if($this->params['isAjax']){ > // if the session expired > $return['login'] = true; > echo json_encode($return); // responseText: "{"login":true}" > } > } > } > } ?> > > Best regards! > > > 2012/8/31 Florin Trifu <[email protected]> > >> Thank you! >> >> This is how I have tried in the first place but it is not working. >> $this->RequestHandler->isAjax() is null or false, so it will never execute >> the conditional code. >> >> Best regards! >> >> -- >> You received this message because you are subscribed to the Google Groups >> "CakePHP" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> Visit this group at http://groups.google.com/group/cake-php?hl=en-US. >> >> >> > > -- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > Visit this group at http://groups.google.com/group/cake-php?hl=en-US. > > > -- --Everything should be made as simple as possible, but not simpler (Albert Einstein) -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
