In order to run and updates against the users table you need to prevent
the auth component from auto redirecting after $this->Auth->user() with:

function beforeFilter() {
    $this->Auth->autoRedirect = false;
}

then in your login routine just set 

$this->User->last_login = date("Y-m-d H:i:s");

*On Fri, Nov 28, 2008 at 11:08:25PM -0800 maytawn <[EMAIL PROTECTED]> wrote:

> Date: Fri, 28 Nov 2008 23:08:25 -0800 (PST)
> From: maytawn <[EMAIL PROTECTED]>
> Subject: Log last login using Auth component
> To: CakePHP <[email protected]>
> 
> 
> I'm looking for some advice on how I might go about capturing the date/
> time a user last successfully logged in.  I'm using the Auth component
> and authentication is working perfectly.  I'm trying to extend the
> functionality by updating a field called 'last_login' in the user
> table.  I have attemped to use the AfterFilter function in the users
> controller to intercept successful logins and update the last_login
> field, but it seems that the AflterFilter function is not even being
> called.  I think it has something to do with the AuthComponent not
> properly returning to the users controller before it redirects to the
> requested page.
> 
> Anyway... maybe I'm missing something... or maybe there is a different
> way to do it.  I'm looking for any suggestions.
> 
> Thanks.
> 
> 
-- 
Jon Molesa
[EMAIL PROTECTED]
if you're bored or curious
http://rjmolesa.com

--~--~---------~--~----~------------~-------~--~----~
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