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