init() public méthode

Initializes the application component.
public init ( )
Exemple #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if ($this->identityClass == null) {
         $this->identityClass = \Yii::$app->getModule('user')->factory->userClass;
     }
     parent::init();
 }
Exemple #2
0
 public function init()
 {
     parent::init();
     if (!$this->getIsGuest() && !$this->getIdentity()->isActive()) {
         $this->logout();
     }
 }
Exemple #3
0
 /**
  * Initializes the User component
  */
 public function init()
 {
     if ($this->identityClass == null) {
         $this->identityClass = 'comyii\\user\\models\\User';
     }
     parent::init();
 }
Exemple #4
0
 public function init()
 {
     parent::init();
     if ($this->userConfig !== null) {
         $this->userConfig = Instance::ensure($this->userConfig, UserConfig::className());
     }
 }
Exemple #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);
     }
 }
Exemple #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;
     }
 }
Exemple #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()));
     }
 }
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_LOGOUT, [$this, 'onBeforeLogout']);
     $this->on(self::EVENT_AFTER_LOGIN, [$this, 'onAfterLogin']);
 }
Exemple #9
0
 public function init()
 {
     parent::init();
     $this->module = Yii::$app->getModule('user');
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->mailer = Instance::ensure($this->mailer, 'im\\users\\components\\UserMailerInterface');
 }
Exemple #11
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->authManager = Yii::$app->authManager;
 }
Exemple #12
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_LOGIN, [$this, 'eventBeforeLogin']);
 }
 public function init()
 {
     parent::init();
 }