Actually I can make it more simple, I will think about and post
more ...

On Feb 22, 7:01 pm, francky06l <[EMAIL PROTECTED]> wrote:
> I have got it working, not tested all cases ...If Baz and EchoChargen
> try, let me know problem and/or enhancements
>
> In UserController if login successful :
>
> $this->Cookie->write(array('user.logged' => 1), null, true, '+1
> day');
>
> I suppose after one day we do not want "Session expired anymore". I
> delete the Cookie value in logout action, but did not paste this
> here ..
> Note the Cookie parameters are set in AppController below..
>
> Now in AppController::beforeFilter
>
>         $this->Cookie->domain = '';
>         $this->Cookie->name   = 'TESTAPP';
>         $this->Cookie->time   = '+30 days';
>
>         if(isset($this->Auth))
>         {
>             if($this->name == 'Pages')  // we might want to test the
> allowed action (in case of beforeFilter set them in Auth before
> calling parent)
>                 $this->Auth->allow('*');
>             else
>             {
>                 $this->Cookie->startup();          // essential to be
> able to read value
>                 $step = $this->Cookie->read('User.logged');
>
>               if(!$this->Session->valid())
>               {
>                   if($v == 1)
>                  {
>                     $this->Cookie->write(array('User.logged' => 2),
> null, true, '+5 minute');
>                    // we give 5 minutes for the user to log in the
> step after
>                  }
>              }
>              else
>             {
>                  if($v == 2)
>                 {
>                     $this->Session->setFlash("Session has expired",
> 'default', array(), 'auth');
>                     $this->Cookie->del("User.logged");
>                }
>            }
>
>           $this->Auth->loginAction = '/users/login';
>       }
>
> That;'s about it ... seems to work ok ..Haven't try all cases I guess
> with different expiration time on cookie values.
>
> hth
> Franck
>
> On Feb 22, 6:03 am, Baz <[EMAIL PROTECTED]> wrote:
>
> > I've given up....Sessions expire and the redirect causes issues. I thought
> > it was a bug, but it's not...Just an annoyance.
>
> > I don't know what's wrong with going the cookie route. With all the
> > redirects, I really don't see a way around it.
>
> > On Thu, Feb 21, 2008 at 10:58 PM, EchoChargen <[EMAIL PROTECTED]> wrote:
>
> > > I'm having a hard go of it on this still.  Has anyone else seen the
> > > behavior above?
> > > Francky - could you elaborate a little on your approach?
> > > Thanks,
> > > Jeremy
>
> > > On Feb 21, 12:30 am, francky06l <[EMAIL PROTECTED]> wrote:
> > > > I have made it work, the only thing I had problem was the first time
> > > > on the page but this can be fixed with Baz approach (Cookie).
> > > > Baz if you pass twice in befoeFilter, you can detect it by setting a
> > > > variable (maybe static) in beforeFiler ?
>
> > > > On Feb 21, 5:32 am, EchoChargen <[EMAIL PROTECTED]> wrote:
>
> > > > > Another thing of note, is if I run through the steps:
> > > > > 1. login, get redirected to what I have in Auth->loginRedirect
> > > > > 2. let session expire
> > > > > 3. click a link to a protected action and get redirected to
> > > Auth->loginAction, and in my case above get a flash message with "your
>
> > > > > session timed out."
> > > > > 4. At this point, if I sit on the login page and let the session
> > > > > timeout again, then submit the login form....at this point
> > > Auth->authError is getting set, I get redirected back to Auth->loginAction
>
> > > > > and the flash.message.auth displays the message I have configured for
> > > > > Auth->authError.
>
> > > > > This is repeatable for me.  Is this behavior anyone else has seen?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to