2016-07-07 64 views
0

我收到错误这样找不到验证处理checkCurrentPassword为current_password

警告(512):找不到验证处理checkCurrentPassword 为current_password [CORE /蛋糕/型号/识别/ CakeValidationRule.php ,281线]

我user.php的

public function validate_passwords() { 
     return check($this->data[$this->alias]['confirm_password'], $this->data[$this->alias]['password']); 
} 
+0

如果有人知道这个帮助我 – Gowthaman

+1

你应该显示你的代码 – Poonam

+1

你应该写你的控制器,视图和模型代码。 –

回答

0

你可以没有这样的访问检查()东阳它是更多信息受保护的方法

看到:http://api.cakephp.org/3.0/class-Cake.Validation.Validation.html

你不尝试类似如下:

public function validate_passwords() { 
    return array('check' => array($this->data[$this->alias]['confirm_password'], $this->data[$this->alias]['password'])); 

}

要使用密码验证confirm_password添加此规则:

$validator->add('confirm_password', 'no-misspelling', [ 
    'rule' => ['compareWith', 'password'], 
    'message' => 'Passwords are not equal', 
]); 
0

你可以用密码

public function validate_passwords() 
{ 
    return $this->data[$this->alias]['password'] === $this->data[$this->alias]['confirm_password']; 
} 

它为你工作用这个验证confirm_password。