當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。