Any ideas regarding this?

How can I ensure that after I am logged in if the session expires the
user is re-directed back to the login page for any new requests coming
in?

By the way, I could probably hack my way around this with a couple of
lines of code in my AppController. I am trying to understand why Auth
is just not simply re-directing after the session expires. Auth does
the right thing if I am not logged in, I get re-directed or sent to
the login page in my case. The question is why not when the session
expires. I am assuming I am missing something.

Thanks in advance,

Alfredo

On Feb 18, 1:38 pm, Alfredo Quiroga-Villamil <laww...@gmail.com>
wrote:
> I am sure there is a way to get this done, just not sure if I am
> missing something. Further details below:
>
> Issue:
> =========
>
> Need to re-direct after session has expired or cleared.
>
> Description:
> =========
>
> I am currently only using the Auth component to handle my
> authentication. No ACL for now. In my AppController I have:
>
> =====================================================================
>         public function beforeFilter() {
>                 parent::beforeFilter();
>                 $this->Auth->loginAction = array('controller' => 'portal', 
> 'action'
> => 'login');
>                 $this->Auth->loginRedirect = array('controller' => 'portal',
> 'action' => 'main');
>                 $this->Auth->logoutRedirect = array('controller' => 'portal',
> 'action' => 'index');
>                 $this->Auth->autoRedirect = false;
>         } // End of beforeFilter()
> =====================================================================
>
> Everything works great. The only issue I currently have is the following:
>
> After the session expire, I am not being re-directed or kicked out of
> the main view.
>
> I am only using cakephp as my backend engine. All my front end is
> built using something else and all I do is send ajax requets. I've
> also looked at the property ajaxLogin under Auth; but after further
> inspection of the code to try to understand what it does I found the
> part in auth.php where I think it's being called. See below:
>
> auth.php from cakephp
>
> =====================================================================
>                 } else {
>                         if (!$this->user()) {
>                                 if (!$this->RequestHandler->isAjax()) {
>                                         
> $this->Session->setFlash($this->authError, 'default', array(), 'auth');
>                                         
> $this->Session->write('Auth.redirect', $url);
>                                         $controller->redirect($loginAction, 
> null, true);
>                                         return false;
>                                 } elseif (!empty($this->ajaxLogin)) {
>                                         $controller->viewPath = 'elements';
>                                         echo 
> $controller->render($this->ajaxLogin, 'ajax');
>                                         $this->_stop();
>                                         return false;
>                                 }
>                         }
>                 }
> =====================================================================
>
> There are no re-directs there, it's rendering as the property
> documentation describes.
>
> How can I ensure that after I am logged in if the session expires the
> user is re-directed back to the login page for any request coming in.?
>
> Thanks in advance,
>
> Alfredo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to