init() public method

Initializes the application component.
public init ( )
Example #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if ($this->identityClass == null) {
         $this->identityClass = \Yii::$app->getModule('user')->factory->userClass;
     }
     parent::init();
 }
Example #2
0
 public function init()
 {
     parent::init();
     if (!$this->getIsGuest() && !$this->getIdentity()->isActive()) {
         $this->logout();
     }
 }
Example #3
0
 /**
  * Initializes the User component
  */
 public function init()
 {
     if ($this->identityClass == null) {
         $this->identityClass = 'comyii\\user\\models\\User';
     }
     parent::init();
 }
Example #4
0
 public function init()
 {
     parent::init();
     if ($this->userConfig !== null) {
         $this->userConfig = Instance::ensure($this->userConfig, UserConfig::className());
     }
 }
Example #5
0
 public function init()
 {
     parent::init();
     $identity = \app\models\User::findByUsername('console_user');
     if ($identity) {
         $this->setIdentity($identity);
     } else {
         throw new Exception("Error console_user not found cannot set console user identity", 1);
     }
 }
Example #6
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // check if user is banned. if so, log user out and redirect home
     /** @var \app\modules\user\models\User $user */
     $user = $this->getIdentity();
     if ($user && $user->ban_time) {
         $this->logout();
         Yii::$app->getResponse()->redirect(['/'])->send();
         return;
     }
 }
Example #7
0
 public function init()
 {
     Yii::$app->setComponents(['session' => ['class' => 'maddoger\\user\\components\\Session'], 'authManager' => ['class' => 'maddoger\\user\\components\\AuthManager', 'defaultRoles' => ['guest']]]);
     /**
      * @var \maddoger\user\UserModule $module
      */
     $module = Yii::$app->getModule('user');
     if ($module) {
         $this->loginUrl = $module->loginUrl;
         $this->enableAutoLogin = $module->autoLogin;
     }
     parent::init();
     if (!$this->getIsGuest()) {
         $this->identity->updateLastVisitTime();
         // $this->identity->setAttribute('login_ip', ip2long(\Yii::$app->getRequest()->getUserIP()));
     }
 }
Example #8
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_LOGOUT, [$this, 'onBeforeLogout']);
     $this->on(self::EVENT_AFTER_LOGIN, [$this, 'onAfterLogin']);
 }
Example #9
0
 public function init()
 {
     parent::init();
     $this->module = Yii::$app->getModule('user');
 }
Example #10
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->mailer = Instance::ensure($this->mailer, 'im\\users\\components\\UserMailerInterface');
 }
Example #11
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->authManager = Yii::$app->authManager;
 }
Example #12
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_LOGIN, [$this, 'eventBeforeLogin']);
 }
Example #13
0
 public function init()
 {
     parent::init();
 }