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. |
public function afterLogin($identity, $cookieBased, $duration) { parent::afterLogin($identity, $cookieBased, $duration); $identity->failedAttempts = 0; $identity->lastLoggedInAt = time(); $identity->save(); }
/** * @inheritdoc */ protected function afterLogin($identity, $cookieBased, $duration) { parent::afterLogin($identity, $cookieBased, $duration); $this->identity->setScenario(self::EVENT_AFTER_LOGIN); $this->identity->setAttribute('login_time', time()); // $this->identity->setAttribute('login_ip', ip2long(\Yii::$app->getRequest()->getUserIP())); $this->identity->save(false); }
/** * @inheritdoc */ protected function afterLogin($identity, $cookieBased, $duration) { parent::afterLogin($identity, $cookieBased, $duration); $this->identity->setScenario(self::EVENT_AFTER_LOGIN); $this->identity->last_visit_at = time(); $this->identity->login_ip = ip2long(\Yii::$app->getRequest()->getUserIP()); $this->identity->save(false); }
protected function afterLogin($identity, $cookieBased, $duration) { // fired by web\User::login methods after a successfull authentication // 1. fire core events parent::afterLogin($identity, $cookieBased, $duration); // 2. fire a hooked action for connected plugins $this->getHook()->do_action('cruge_afterlogin', array($identity, $cookieBased, $duration)); }
/** * @inheritdoc */ protected function afterLogin($identity, $cookieBased, $duration) { parent::afterLogin($identity, $cookieBased, $duration); if (\Yii::$app->getModule('user')->trackable) { $this->identity->setAttribute('logged_in_from', ip2long(\Yii::$app->getRequest()->getUserIP())); $this->identity->setAttribute('logged_in_at', time()); $this->identity->save(false); } }
protected function afterLogin($identity, $fromCookie, $duration) { if ($this->_identity !== null) { if (\Yii::$app->phpBB->login($this->_identity->username, $this->_identity->password_reg) != 'SUCCESS') { throw new InvalidParamException('Не удалось пройти авторизацию на форуме'); } } parent::afterLogin($identity, $fromCookie, $duration); }
/** * @inheritdoc */ protected function afterLogin($identity, $cookieBased, $duration) { $identity = $this->identity; $identity->setAttribute('last_visit_at', TIMESTAMP); // $identity->setAttribute('last_login_ip', ip2long(Yii::$app->getRequest()->getUserIP())); $identity->setAttribute('last_login_ip', Yii::$app->getRequest()->getUserIP()); $identity->save(false); parent::afterLogin($identity, $cookieBased, $duration); }
/** * @inheritdoc */ public function afterLogin($identity, $cookieBased, $duration) { parent::afterLogin($identity, $cookieBased, $duration); // обновляем время авторизации и статус online if ($identity && $identity instanceof \nepster\users\models\User) { $identity->time_activity = time(); $identity->save(false); } // Авторизация с поддомена по кукам if (Yii::$app->id == 'app-backend') { //TODO: проверить права доступа // echo 'Авторизация с поддомена по кукам'; // die(); } }
protected function afterLogin($identity, $cookieBased, $duration) { parent::afterLogin($identity, $cookieBased, $duration); }
/** * @inheritdoc */ public function afterLogin($identity, $cookieBased, $duration) { /** @var \amnah\yii2\user\models\User $identity */ $identity->updateLoginMeta(); parent::afterLogin($identity, $cookieBased, $duration); }
/** * @inheritdoc */ protected function afterLogin($identity, $cookieBased, $duration) { AuthHelper::updatePermissions($identity); parent::afterLogin($identity, $cookieBased, $duration); }
/** * @inheritdoc */ public function afterLogin($identity, $cookieBased, $duration) { $identity->updateAttributes(['last_login' => new \yii\db\Expression('NOW()')]); parent::afterLogin($identity, $cookieBased, $duration); }
/** * @inheritdoc */ public function afterLogin($identity, $cookieBased, $duration) { /** @var \dkeeper\yii2\user\models\User $identity */ $identity->afterLogin(); parent::afterLogin($identity, $cookieBased, $duration); }
/** @inheritdoc */ public function afterLogin($identity, $cookieBased, $duration) { $identity = $this->getIdentity(); if ($identity !== null) { $user = \common\models\User::findOne($identity->getId()); $user->login_count++; $user->logged_in_at = time(); $user->logged_in_from = \Yii::$app->request->userIP; $user->update(); } return parent::afterLogin($identity, $cookieBased, $duration); }
/** * @inheritdoc */ public function afterLogin($identity, $cookieBased, $duration) { $identity->setLoginIpAndTime(); return parent::afterLogin($identity, $cookieBased, $duration); }
/** * @inheritdoc */ protected function afterLogin($identity, $cookieBased, $duration) { parent::afterLogin($identity, $cookieBased, $duration); $this->identity->updateLastVisitTime(); }