Invalid Argument – yii\base\InvalidArgumentException
Hash is invalid.
in /var/www/abc/vendor/yiisoft/yii2/base/Security.phpat line 651
642643644645646647648649650651652653654655656657658659660 {
if (!is_string($password) || $password === '') {
throw new InvalidArgumentException('Password must be a string and cannot be empty.');
}
if (!preg_match('/^\$2[axy]\$(\d\d)\$[\.\/0-9A-Za-z]{22}/', $hash, $matches)
|| $matches[1] < 4
|| $matches[1] > 30
) {
throw new InvalidArgumentException('Hash is invalid.');
}
if (function_exists('password_verify')) {
return password_verify($password, $hash);
}
$test = crypt($password, $hash);
$n = strlen($test);
if ($n !== 60) {
in /var/www/abc/vendor/fancyecommerce/fec_admin/models/AdminUser.php at line 219– yii\base\Security::validatePassword('test', null)
213214215216217218219220221222223224225 *
- @param string $password password to validate
- @return boolean 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
in /var/www/abc/vendor/fancyecommerce/fec_admin/models/AdminUser/AdminUserLogin.php at line 38– fecadmin\models\AdminUser::validatePassword('test')
32333435363738394041424344 public function validatePassword($attribute,$params){
if (!$this->hasErrors()) {
$AdminUser = $this->getAdminUser();
if (!$AdminUser) {
$this->addError('用户名', '用户名不存在');
}else if(!$AdminUser->validatePassword($this->password)){
$this->addError('用户名或密码','不正确');
}
}
}