本文整理汇总了PHP中yii\web\User::init方法的典型用法代码示例。如果您正苦于以下问题:PHP User::init方法的具体用法?PHP User::init怎么用?PHP User::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\web\User
的用法示例。
在下文中一共展示了User::init方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* @inheritdoc
*/
public function init()
{
if ($this->identityClass == null) {
$this->identityClass = \Yii::$app->getModule('user')->factory->userClass;
}
parent::init();
}
示例2: init
public function init()
{
parent::init();
if (!$this->getIsGuest() && !$this->getIdentity()->isActive()) {
$this->logout();
}
}
示例3: init
/**
* Initializes the User component
*/
public function init()
{
if ($this->identityClass == null) {
$this->identityClass = 'comyii\\user\\models\\User';
}
parent::init();
}
示例4: init
public function init()
{
parent::init();
if ($this->userConfig !== null) {
$this->userConfig = Instance::ensure($this->userConfig, UserConfig::className());
}
}
示例5: init
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);
}
}
示例6: init
/**
* @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;
}
}
示例7: init
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()));
}
}
示例8: init
public function init()
{
parent::init();
$this->on(self::EVENT_BEFORE_LOGOUT, [$this, 'onBeforeLogout']);
$this->on(self::EVENT_AFTER_LOGIN, [$this, 'onAfterLogin']);
}
示例9: init
public function init()
{
parent::init();
$this->module = Yii::$app->getModule('user');
}
示例10: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$this->mailer = Instance::ensure($this->mailer, 'im\\users\\components\\UserMailerInterface');
}
示例11: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$this->authManager = Yii::$app->authManager;
}
示例12: init
public function init()
{
parent::init();
$this->on(self::EVENT_BEFORE_LOGIN, [$this, 'eventBeforeLogin']);
}
示例13: init
public function init()
{
parent::init();
}