В методе авторизации:
Код: Выделить всё
$model = new LoginForm;
if ($model->load(Yii::$app->request->post()) && $model->login()) {
......
Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0);
......
Код: Выделить всё
protected function afterLogin($identity, $cookieBased, $duration)
{
$this->trigger(self::EVENT_AFTER_LOGIN, new UserEvent([
'identity' => $identity,
'cookieBased' => $cookieBased,
'duration' => $duration,
]));
}
Т.е. в модели User, в контроллере?