afterLogin() protected method

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.
示例#1
0
文件: User.php 项目: ahb360/cms
 public function afterLogin($identity, $cookieBased, $duration)
 {
     parent::afterLogin($identity, $cookieBased, $duration);
     $identity->failedAttempts = 0;
     $identity->lastLoggedInAt = time();
     $identity->save();
 }
示例#2
0
 /**
  * @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);
 }
示例#3
0
 /**
  * @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);
 }
示例#4
0
 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));
 }
示例#5
0
 /**
  * @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);
 }
示例#7
0
文件: User.php 项目: igaojie/yii-QA
 /**
  * @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);
 }
示例#8
0
 /**
  * @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();
     }
 }
示例#9
0
文件: User.php 项目: luhaoz/mcwiki
 protected function afterLogin($identity, $cookieBased, $duration)
 {
     parent::afterLogin($identity, $cookieBased, $duration);
 }
示例#10
0
文件: User.php 项目: amnah/yii2-user
 /**
  * @inheritdoc
  */
 public function afterLogin($identity, $cookieBased, $duration)
 {
     /** @var \amnah\yii2\user\models\User $identity */
     $identity->updateLoginMeta();
     parent::afterLogin($identity, $cookieBased, $duration);
 }
示例#11
0
 /**
  * @inheritdoc
  */
 protected function afterLogin($identity, $cookieBased, $duration)
 {
     AuthHelper::updatePermissions($identity);
     parent::afterLogin($identity, $cookieBased, $duration);
 }
示例#12
0
 /**
  * @inheritdoc
  */
 public function afterLogin($identity, $cookieBased, $duration)
 {
     $identity->updateAttributes(['last_login' => new \yii\db\Expression('NOW()')]);
     parent::afterLogin($identity, $cookieBased, $duration);
 }
示例#13
0
 /**
  * @inheritdoc
  */
 public function afterLogin($identity, $cookieBased, $duration)
 {
     /** @var \dkeeper\yii2\user\models\User $identity */
     $identity->afterLogin();
     parent::afterLogin($identity, $cookieBased, $duration);
 }
示例#14
0
 /** @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);
 }
示例#15
0
文件: User.php 项目: filsh/yii2-user
 /**
  * @inheritdoc
  */
 public function afterLogin($identity, $cookieBased, $duration)
 {
     $identity->setLoginIpAndTime();
     return parent::afterLogin($identity, $cookieBased, $duration);
 }
示例#16
0
 /**
  * @inheritdoc
  */
 protected function afterLogin($identity, $cookieBased, $duration)
 {
     parent::afterLogin($identity, $cookieBased, $duration);
     $this->identity->updateLastVisitTime();
 }