本文整理汇总了PHP中dektrium\user\Finder::findUserById方法的典型用法代码示例。如果您正苦于以下问题:PHP Finder::findUserById方法的具体用法?PHP Finder::findUserById怎么用?PHP Finder::findUserById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dektrium\user\Finder
的用法示例。
在下文中一共展示了Finder::findUserById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findModel
/**
* Finds the User model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
*
* @param int $id
*
* @return User the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
$user = $this->finder->findUserById($id);
if ($user === null) {
throw new NotFoundHttpException('The requested page does not exist');
}
return $user;
}
示例2: actionConfirm
/**
* Confirms user's account. If confirmation was successful logs the user and shows success message. Otherwise
* shows error message.
*
* @param int $id
* @param string $code
*
* @return string
* @throws \yii\web\HttpException
*/
public function actionConfirm($id, $code)
{
$user = $this->finder->findUserById($id);
if ($user === null || $this->module->enableConfirmation == false) {
throw new NotFoundHttpException();
}
$user->attemptConfirmation($code);
return $this->render('/message', ['title' => Yii::t('user', 'Account confirmation'), 'module' => $this->module]);
}
示例3: actionConfirm
/**
* Attempts changing user's password.
*
* @param int $id
* @param string $code
*
* @return string
* @throws \yii\web\HttpException
*/
public function actionConfirm($id, $code)
{
$user = $this->finder->findUserById($id);
if ($user === null || $this->module->emailChangeStrategy == Module::STRATEGY_INSECURE) {
throw new NotFoundHttpException();
}
$user->attemptEmailChange($code);
return $this->redirect(['account']);
}
示例4: actionConfirm
/**
* Attempts changing user's email address.
*
* @param int $id
* @param string $code
*
* @return string
* @throws \yii\web\HttpException
*/
public function actionConfirm($id, $code)
{
$user = $this->finder->findUserById($id);
if ($user === null || $this->module->emailChangeStrategy == Module::STRATEGY_INSECURE) {
throw new NotFoundHttpException();
}
$event = $this->getUserEvent($user);
$this->trigger(self::EVENT_BEFORE_CONFIRM, $event);
$user->attemptEmailChange($code);
$this->trigger(self::EVENT_AFTER_CONFIRM, $event);
return $this->redirect(['account']);
}
示例5: actionConfirm
/**
* Confirms user's account. If confirmation was successful logs the user and shows success message. Otherwise
* shows error message.
*
* @param int $id
* @param string $code
*
* @return string
* @throws \yii\web\HttpException
*/
public function actionConfirm($id, $code)
{
$user = $this->finder->findUserById($id);
$event = $this->getUserEvent($user);
if ($user === null || $this->module->enableConfirmation == false) {
throw new NotFoundHttpException();
}
$this->trigger(self::EVENT_BEFORE_CONFIRM, $event);
$user->attemptConfirmation($code);
$this->trigger(self::EVENT_AFTER_CONFIRM, $event);
return $this->render('/message', ['title' => Yii::t('user', 'Account confirmation'), 'module' => $this->module]);
}