Bug Report #4432
Fix 'password confirm' error message in ORM module
When using the get_password_validation() rules for validation a password_cofirm field, the error message returned is "password confirm must be the same as password confirm".
In the ORM module, the user model sets the password_confirm rule as follows:
return Validation::factory($values) ->rule('password', 'min_length', array(':value', 8)) ->rule('password_confirm', 'matches', array(':validation', ':field', 'password'));
The 'matches' validation message is ':field must be the same as :param2', see here https://github.com/kohana/core/blob/3.3/develop/messages/validation.php#L18
Without digging too deep in the validation classes, it appears the issue here is the order of the validation fields.
To keep the messages consistant, I think we should make a small adjustment to the model class to adjust the order of the fields passed into the validation rule.
#4 Updated by Lorenzo Pisani about 1 year ago
- Status changed from Assigned to Closed
- Assignee changed from #<Principal:0x7f05d0f5cdf0> to #<Principal:0x7f05d0f608d8>
- % Done changed from 0 to 100
- Resolution set to fixed
I think it makes more sense to fix it by adjusting the message file. The matches method takes three parameters: $array, $field, $matches so the third parameter is the one you are matching, not the second.