yii\web\User::afterLogin PHP Метод

afterLogin() защищенный Метод

The default implementation will trigger the [[EVENT_AFTER_LOGIN]] event. If you override this method, make sure you call the parent implementation so that the event is triggered.
protected afterLogin ( yii\web\IdentityInterface $identity, boolean $cookieBased, integer $duration )
$identity yii\web\IdentityInterface the user identity information
$cookieBased boolean whether the login is cookie-based
$duration integer number of seconds that the user can remain in logged-in status. If 0, it means login till the user closes the browser or the session is manually destroyed.
    protected function afterLogin($identity, $cookieBased, $duration)
    {
        $this->trigger(self::EVENT_AFTER_LOGIN, new UserEvent(['identity' => $identity, 'cookieBased' => $cookieBased, 'duration' => $duration]));
    }

Usage Example

Пример #1
0
 public function afterLogin($identity, $cookieBased, $duration)
 {
     parent::afterLogin($identity, $cookieBased, $duration);
     $identity->failedAttempts = 0;
     $identity->lastLoggedInAt = time();
     $identity->save();
 }
All Usage Examples Of yii\web\User::afterLogin