当 new_password 和 confirm_password 字段不在数据库中时,如何匹配它们?
嗨...我想知道如何匹配我的字段“new_password”和“confirm_password”,它们不存储在数据库中,它们仅用于更改密码模块中的匹配目的。
我试过这个,但没有奏效:
if($this->data['User']['new_password'] != $this->data['User']['confirm_password'] ) {
$this->Session->setFlash("New password and Confirm password field do not match");
} else {
$this->data['User']['password'] = $this->data['User']['new_password'];
$this->data['User']['id'] = $this->User->id;
if($this->User->save($this->data)) {
$this->Session->setFlash("Password updated");
$this->redirect('/users/login');
}
}