我已根据我的用户表自定义了注册表单,在自定义后我尝试注册我使用' 123456'填写了密码表单。作为密码。完成注册后,它说我输入了错误的密码?
这里是SignupForm模型的方法:
public function signup()
{
if (!$this->validate()) {
return null;
}
$user = new User();
$user->username = $this->username;
$user->email = $this->email;
$user->setPassword($this->password);
$user->generateAuthKey();
$user->first_name = $this->first_name;
$user->middle_name = $this->middle_name;
$user->last_name = $this->last_name;
$user->contact = $this->contact;
$user->birth_date = $this->birth_date;
$user->type = $this->type;
$user->external_type = $this->external_type;
$user->status = $this->status;
$user->region_id = $this->region_id;
$user->barangay_id = $this->barangay_id;
$user->province_id = $this->province_id;
$user->city_municipal_id = $this->city_municipal_id;
return $user->save() ? $user : null;
}
用户模型
public function setPassword($password)
{
$this->password_hash = Yii::$app->security->generatePasswordHash($password);
}
我遵循了Yii2高级应用程序的正确安装程序,我已经完成了迁移。它出了什么问题?