当前位置: 首页>>代码示例>>PHP>>正文


PHP User::findByPasswordResetToken方法代码示例

本文整理汇总了PHP中common\models\User::findByPasswordResetToken方法的典型用法代码示例。如果您正苦于以下问题:PHP User::findByPasswordResetToken方法的具体用法?PHP User::findByPasswordResetToken怎么用?PHP User::findByPasswordResetToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common\models\User的用法示例。


在下文中一共展示了User::findByPasswordResetToken方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Creates a form model given a token.
  *
  * @param  string                          $token
  * @param  array                           $config name-value pairs that will be used to initialize the object properties
  * @throws \yii\base\InvalidParamException if token is empty or not valid
  */
 public function __construct($token, $config = [])
 {
     if (empty($token) || !is_string($token)) {
         throw new InvalidParamException('Password reset token cannot be blank.');
     }
     $this->user = User::findByPasswordResetToken($token);
     if (!$this->user) {
         throw new InvalidParamException('Wrong password reset token.');
     }
     parent::__construct($config);
 }
开发者ID:rocketyang,项目名称:yii2-starter-kit,代码行数:18,代码来源:ResetPasswordForm.php

示例2: __construct

 /**
  * Creates a form model given a token.
  *
  * @param  string                          $token
  * @param  array                           $config name-value pairs that will be used to initialize the object properties
  * @throws \yii\base\InvalidParamException if token is empty or not valid
  */
 public function __construct($token, $config = [])
 {
     if (empty($token) || !is_string($token)) {
         throw new InvalidParamException('Sem Token de redefinição de palavra passe.');
     }
     $this->_user = User::findByPasswordResetToken($token);
     if (!$this->_user) {
         throw new InvalidParamException('Token de redefinição de palavra passe errado.');
     }
     parent::__construct($config);
 }
开发者ID:afernandes465,项目名称:fafediesel,代码行数:18,代码来源:ResetPasswordForm.php

示例3: __construct

 /**
  * Creates a form model given a token.
  *
  * @param  string                          $token
  * @param  array                           $config name-value pairs that will be used to initialize the object properties
  * @throws \yii\base\InvalidParamException if token is empty or not valid
  */
 public function __construct($token, $config = [])
 {
     if (empty($token) || !is_string($token)) {
         throw new InvalidParamException(Yii::t('app', 'PASSWORD_TOKEN_CAN_BELANK'));
     }
     $this->_user = User::findByPasswordResetToken($token);
     if (!$this->_user) {
         throw new InvalidParamException(Yii::t('app', 'WRONG_PASSWORD_TOKEN'));
     }
     parent::__construct($config);
 }
开发者ID:BCxTIM,项目名称:myblog,代码行数:18,代码来源:ResetPasswordForm.php

示例4: __construct

 public function __construct($token, $config = [])
 {
     if (empty($token) || !is_string($token)) {
         throw new InvalidParamException('Password reset token cannot be blank.');
     }
     $this->_user = User::findByPasswordResetToken($token);
     if (!$this->_user) {
         //throw new InvalidParamException('Wrong password reset token.');
         throw new \yii\web\BadRequestHttpException('Password reset link is expired or invalid.');
     }
     parent::__construct($config);
 }
开发者ID:rubedkhan2149,项目名称:2149,代码行数:12,代码来源:ResetPasswordForm.php

示例5: actionResetPassword

 public function actionResetPassword($token)
 {
     try {
         $model = new ResetPasswordForm($token);
     } catch (InvalidParamException $e) {
         Yii::$app->getSession()->setFlash('danger', ['type' => 'danger', 'duration' => 5000, 'icon' => 'glyphicon glyphicon-exclamation-sign', 'message' => 'Parámetro inválido', 'title' => 'Reestablecer contraseña', 'positonY' => 'top', 'positonX' => 'center']);
         return $this->goHome();
         //throw new BadRequestHttpException($e->getMessage()); al mostrar el error lo hace en el layout main en vez de landing
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
         Yii::$app->getSession()->setFlash('success', ['type' => 'success', 'duration' => 5000, 'icon' => 'glyphicon glyphicon-user', 'message' => 'La contraseña se ha guardado con éxito.', 'title' => 'Reestablecer contraseña', 'positonY' => 'top', 'positonX' => 'center']);
         return $this->goHome();
     }
     $user = User::findByPasswordResetToken($token);
     if (!$user) {
         throw new InvalidParamException('Wrong password reset token.');
     }
     return $this->renderAjax('resetPassword', ['model' => $model, 'user' => $user]);
 }
开发者ID:vilariel,项目名称:remisesramallo,代码行数:19,代码来源:HomeController.php


注:本文中的common\models\User::findByPasswordResetToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。