本文整理汇总了PHP中App\Modules\User\Module::param方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::param方法的具体用法?PHP Module::param怎么用?PHP Module::param使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Modules\User\Module
的用法示例。
在下文中一共展示了Module::param方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isValidToken
/**
* Check if token is valid.
*
* @return boolean true if token is valid
*/
public function isValidToken()
{
if (SecurityHelper::isValidToken($this->token, Module::param('emailWithin', 14400)) === true) {
return ($this->_model = static::findOne(['token' => $this->token])) !== null;
}
return false;
}
示例2: run
/**
* Sign Up page.
* If record will be successful created, user will be redirected to home page.
*/
public function run()
{
$user = Yii::createObject($this->modelClass, ['scenario' => 'signup']);
$profile = Yii::createObject($this->profileClass);
$post = Yii::$app->request->post();
if ($user->load($post) && $profile->load($post)) {
if ($user->validate() && $profile->validate()) {
$user->populateRelation('profile', $profile);
if ($user->save(false)) {
if (Module::param('requireEmailConfirmation', false)) {
$this->trigger('success', new Event(['data' => Module::t('model', 'Your account has been created successfully. An email has been sent to you with detailed instructions.', ['url' => Url::to($this->resendRoute)])]));
} else {
Yii::$app->user->login($user);
$this->trigger('success', new Event(['data' => Module::t('model', 'Your account has been created successfully.')]));
}
return $this->controller->goHome();
} else {
$this->trigger('danger', new Event(['data' => Module::t('model', 'Create account failed. Please try again later.')]));
return $this->controller->refresh();
}
} elseif (Yii::$app->request->isAjax) {
Yii::$app->response->format = Response::FORMAT_JSON;
return array_merge(ActiveForm::validate($user), ActiveForm::validate($profile));
}
}
return $this->render(compact('user', 'profile'));
}
示例3: isValidToken
/**
* Check if token is valid.
*
* @return boolean true if token is valid
*/
public function isValidToken()
{
if (SecurityHelper::isValidToken($this->token, Module::param('recoveryWithin', false)) === true) {
return ($this->_user = User::findByToken($this->token, 'active')) !== null;
}
return false;
}
示例4: sendSignUpEmail
public static function sendSignUpEmail(Model $model)
{
if (Module::param('requireEmailConfirmation', false)) {
return self::getInstance()->getMail()->compose('signup', ['model' => $model])->setTo($model->email)->setSubject(Module::t('mail', 'EMAIL_SUBJECT_SIGNUP') . ' ' . Yii::$app->name)->send();
}
return false;
}
示例5: setDefaultStatus
/**
* @param int $status
* @return $this
*/
public function setDefaultStatus($status = self::STATUS_ACTIVE)
{
if (Module::param('requireEmailConfirmation', false)) {
$status = self::STATUS_INACTIVE;
}
// Set default status
if (!$this->status_id) {
$this->status_id = $status;
}
return $this;
}