我正在尝试使用 ajax 来更改密码选项。在这里,我在控制器中尝试了以下代码
if ($this->request->is(array('post', 'put'))){
$id=$this->Auth->user('id');
$changePass=$_POST['cpass'];
$cpasss=AuthComponent::password($changePass);
echo $cpasss;
$up=$this->User->updateAll(
array('User.password'=>"$cpasss"),
array('User.id'=>"$id")
);
}
这里的哈希工作正常,我见过萤火虫,但问题是这里的密码没有在数据库中更新。如果我删除
$cpasss=AuthComponent::password($changePass);
然后密码更新正常,但没有哈希。有人可以帮我解决这个问题吗?