Reputation: 4606
I have a very strange problem, i have created a simple form to add user into db.
The code works very well, the users are correctly saved into db.
But...
I have a problem using the validation, this is an extract of my validate array regarding the password field:
public $validate = array(
...
'password' => array(
'rule' => array('minLength', 4),
'required' => true,
'message' => "La password deve essere lunga almeno 4 caratteri"
)
);
The minLength rule works correctly, but if i try to show the messages doing:
debug($this->User->validationErrors);
in my controller. I see this output:
array(
'password' => '*****'
)
why "*" ??
I would like to get the message I wrote in the $validate
array.
This problem only occurs on the password field.
Upvotes: 0
Views: 137
Reputation: 2968
Because password is hashed, and has over than 4 chars. You must check password and after validate hash in beforeSave:)
What kind of version of Cake You are using?
Upvotes: 0
Reputation: 21743
That is some stupid "security feature" one had to implement to avoid some careless people to display their database password on their websites (because they forgot to turn debug off). So if the key "password", "schema" etc is in the array the value will be cloaked.
Just use pr(), var_dump(), print_r() or any other method that does not do that.
PS: you could have found that out taking a look at the code ( https://github.com/cakephp/cakephp/blob/master/lib/Cake/Utility/Debugger.php#L449 )
Upvotes: 2