Here's an updated function to support the good Dr Lecter's idea of
resetting the cookie each time the user logs in. I'm fairly sure it
works...

function loginFromCookie() {
   $cookie = $this->Cookie->read('Auth.User');
   if (!is_null($cookie)) {
     if ($this->Auth->login($cookie)) {
       //  Clear auth message, just in case we use it.
       $this->Session->del('Message.auth');

       // Write the cookie out again, so the user stays in for another
two weeks
       $this->Cookie->write('Auth.User', $cookie, true, '+2 weeks');
     } else { // Delete invalid Cookie
       $this->Cookie->del('Auth.User');
     }
   }
  }
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to