/** * 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 = []) { parent::__construct($config); if (empty($token) || !is_string($token)) { throw new InvalidParamException(Yii::t('admin', 'Missing password reset token.')); } $this->_user = Admin::findByPasswordResetToken($token); if (!$this->_user) { throw new InvalidParamException(Yii::t('admin', 'Invalid password reset token.')); } }