Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication error #189

Closed
parthasarathi2015 opened this issue Jun 6, 2017 · 2 comments
Closed

Authentication error #189

parthasarathi2015 opened this issue Jun 6, 2017 · 2 comments

Comments

@parthasarathi2015
Copy link

Unknown Property – yii\base\UnknownPropertyException

Getting unknown property: common\models\User::password_hash
in E:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Component.php at line 147
138139140141142143144145146147148149150151152153154155156

        if ($behavior->canGetProperty($name)) {
            return $behavior->$name;
        }
    }

    if (method_exists($this, 'set' . $name)) {
        throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name);
    }

    throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
}

/**
 * Sets the value of a component property.
 * This method will check in the following order and act accordingly:
 *
 *  - a property defined by a setter: set the property value
 *  - an event in the format of "on xyz": attach the handler to the event "xyz"
 *  - a behavior in the format of "as xyz": attach the behavior named as "xyz"
  1. in E:\xampp\htdocs\yii2\vendor\yiisoft\yii2\db\BaseActiveRecord.php at line 286 – yii\base\Component::__get('password_hash')

  2. in E:\xampp\htdocs\yii2\common\models\User.php at line 153 – yii\db\BaseActiveRecord::__get('password_hash')
    147148149150151152153154155156157158159

    • @param string $password password to validate
    • @return bool if password provided is valid for current user
      */
      public function validatePassword($password)
      {
      return Yii::$app->security->validatePassword($password, $this->password_hash);
      }

    /**

    • Generates password hash from password and sets it to the model
    • @param string $password
  3. in E:\xampp\htdocs\yii2\common\models\LoginForm.php at line 45 – common\models\User::validatePassword('111111')
    39404142434445464748495051

    • @param array $params the additional name-value pairs given in the rule
      */
      public function validatePassword($attribute, $params)
      {
      if (!$this->hasErrors()) {
      $user = $this->getUser();
      if (!$user || !$user->validatePassword($this->password)) {
      $this->addError($attribute, 'Incorrect username or password.');
      }
      }
      }

    /**

  4. common\models\LoginForm::validatePassword('password', null, yii\validators\InlineValidator)

  5. in E:\xampp\htdocs\yii2\vendor\yiisoft\yii2\validators\InlineValidator.php at line 72 – call_user_func([common\models\LoginForm, 'validatePassword'], 'password', null, yii\validators\InlineValidator)

@amnah
Copy link
Owner

amnah commented Jun 6, 2017

go to user/login instead of site/login

@amnah
Copy link
Owner

amnah commented Oct 29, 2017

added a note in the readme for this 5256767

@amnah amnah closed this as completed Oct 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants