문제

I'm new to Agile Toolkit and I'm trying to make some sort of trigger/log on user auth.

For example, after successful login, I want to execute some query like:

UPDATE `user_login` SET `user_id` = XXX, `login_date` = NOW();

I've searched documentation and googled for it but still can't find the way to do this.

Thank you!

EDIT: my solution (thank you @DarkSide ;)

In class Frontend:

$this->add('Auth')->setModel('User');

$this->auth->addHook('loggedIn', function($m)
{
    $l = $this->add('Model_User_Login');
    $l['user_id'] = $m->info['id'];
    $l['date'] = date('Y-m-d H:i:s');
    $l->save();
});
도움이 되었습니까?

해결책

See /atk4/lib/Auth/Basic.php class Auth_Basic method loggedIn().

I guess you can overwrite or extend it to fit your needs.

There is also a hook called loggedIn.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top