本文整理匯總了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();
}