Vote count:
0
I'm using Cakephp framework and I'm trying to verify that the passwords that are written at the "password" and "password confirmation" fields of the register page match but I get an error.
This is my code:
App::uses('AuthComponent', 'Controller/Component');
class User extends AppModel {
public $name = 'User';
public $validate = array(
'username' => array(
'required' => array(
'rule' => array('notEmpty'),
'message' => 'A username is required'
)
),
'password' => array(
'required' => array(
'rule' => array('notEmpty'),
'message' => 'A password is required'
)
'Match passwords'=>array(
'rule' => 'matchPasswords'
'message' => 'Your passwords do not match'
)
),
'password_confirmation' => array(
'required' => array(
'rule' => array('notEmpty'),
'message' => 'Please confirm your password'
)
)
);
public function matchPasswords($data){
if($data['password'] == $this->data['User']['password_confirmation']){
return true;
}
return false;
}
}
This is the error that I get:
Fatal Error Error: syntax error, unexpected ''Match passwords'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' File: C:\xampp\htdocs\cakeblog\app\Model\User.php
Line: 18
asked 59 secs ago
CakePhp:syntax error (T_CONSTANT_ENCAPSED_STRING), expecting ')'
Aucun commentaire:
Enregistrer un commentaire