Finds user by password reset token
public static findByPasswordResetToken ( string $token ) : static | null | ||
$token | string | password reset token |
Résultat | static | null |
/** * 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); }
/** * 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); }
/** * 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('Пароль обязателен к заполнению.'); } $this->_user = User::findByPasswordResetToken($token); if (!$this->_user) { throw new InvalidParamException('Неверный токен восстановления пароля.'); } parent::__construct($config); }
/** * 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('参数错误!'); } $this->_user = User::findByPasswordResetToken($token); if (!$this->_user) { throw new InvalidParamException('未找到需要重置密码的用户!'); } parent::__construct($config); }
/** * 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('Ключ для восстановления пароля не найден.'); } $this->_user = User::findByPasswordResetToken($token); if (!$this->_user) { throw new InvalidParamException('Неправильный ключ для восстановления пароля.'); } parent::__construct($config); }
/** * 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('Поле не может быть пустым'); } $this->_user = User::findByPasswordResetToken($token); if (!$this->_user) { throw new InvalidParamException('Неправильно заполнено поле'); } parent::__construct($config); }
/** * 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('El token no puede estar vacio'); } $this->_user = User::findByPasswordResetToken($token); if (!$this->_user) { throw new InvalidParamException('El token es incorrecto por favor revise su correo'); } parent::__construct($config); }
/** * 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); }
/** * 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('Токен не может быть пустым!'); } $this->_user = User::findByPasswordResetToken($token); if (!$this->_user) { throw new InvalidParamException('Не верный токен для обновления пароля!'); } parent::__construct($config); }
/** * 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.'); throw new InvalidParamException('Tiene que contener un valor.'); } $this->_user = User::findByPasswordResetToken($token); if (!$this->_user) { throw new InvalidParamException('Clave inválida.'); } parent::__construct($config); }
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); }
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]); }