and i forgor...maybe you want to disable autoRedirect option.... http://book.cakephp.org/view/1274/autoRedirect -- Lep pozdrav, Tilen Majerle http://majerle.eu
2011/2/23 Tilen Majerle <[email protected]> > first, use RequestHandler component....then check if is Ajax request so... > > if ($this->RequestHandler->isAjax()) > { > $this->layout = 'ajax'; > } > else //not ajax, make redirect > { > $this->redirect('/'); > } > > make a layout new and name it "ajax.ctp" and put this inside: > <?php print $contents_for_layout; ?> > > and in a view of controller, action, do this: > > <?php print $this->Session->flash('auth'); ?> > > > > so if i explain, if there is no ajax call, it will redirect user, if IS > ajax, then will load new layout, which will display only view file of some > Controller/action idk like users/login.ctp and there inside login.ctp is > SessionHelper::flash() method which will display if any errors accured when > login...do u understand? > > > -- > Lep pozdrav, Tilen Majerle > http://majerle.eu > > > > 2011/2/23 Julien Barbedette <[email protected]> > > Hi, >> >> By default, the Auth component used with the ACL component redirects >> the user to the referer when this one can't access to the controller/ >> action (last lines of method startup in auth component): >> >> if ($this->isAuthorized($type)) { >> return true; >> } >> >> $this->Session->setFlash($this->authError, >> $this->flashElement, >> array(), 'auth'); >> $controller->redirect($controller->referer(), null, true); >> return false; >> >> This is ok when you make a classic HTTP query but what about an AJAX >> query? In my case, I don't want to display a complete page in my AJAX >> dialog but only a message alerting the user that he can't access to >> the page. >> >> Any idea to manage that or if a solution already exists? >> >> Thanks >> >> -- >> Our newest site for the community: CakePHP Video Tutorials >> http://tv.cakephp.org >> Check out the new CakePHP Questions site http://ask.cakephp.org and help >> others with their CakePHP related questions. >> >> >> To unsubscribe from this group, send email to >> [email protected] For more options, visit this group >> at http://groups.google.com/group/cake-php >> > > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
