Add last-login-ip capture capability (#184)
This commit is contained in:
committed by
Lorenzo Milesi
parent
01d9052416
commit
71f9587374
@ -137,7 +137,10 @@ class SecurityController extends Controller
|
||||
|
||||
$this->trigger(FormEvent::EVENT_BEFORE_LOGIN, $event);
|
||||
if ($form->login()) {
|
||||
$form->getUser()->updateAttributes(['last_login_at' => time()]);
|
||||
$form->getUser()->updateAttributes([
|
||||
'last_login_at' => time(),
|
||||
'last_login_ip' => Yii::$app->request->getUserIP(),
|
||||
]);
|
||||
|
||||
$this->trigger(FormEvent::EVENT_AFTER_LOGIN, $event);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user