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