Bug Report #4432
Fix 'password confirm' error message in ORM module
| Status: | Closed | Start date: | 02/07/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | - | |||
| Target version: | v3.3.0 | |||
| Resolution: | fixed | Points: |
Description
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'));
See https://github.com/kohana/orm/blob/3.3/develop/classes/model/auth/user.php#L140-142
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.
History
Updated by Richard Willis over 1 year ago
Blast, I'm sorry for creating this issue in the wrong section. Please let me know if I should recreate this issue for the k3-orm project.
Pull request here: https://github.com/kohana/orm/pull/55
Updated by Lorenzo Pisani over 1 year ago
- Project changed from Kohana v3.x to ORM
Updated by Isaiah DeRose-Wilson about 1 year ago
- Status changed from New to Assigned
- Assignee set to Isaiah DeRose-Wilson
- Target version set to v3.3.0
- Points deleted (
1)
Updated by Lorenzo Pisani 8 months ago
- Status changed from Assigned to Closed
- Assignee changed from Isaiah DeRose-Wilson to Lorenzo Pisani
- % 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.
Updated by Lorenzo Pisani 8 months ago
- Project changed from ORM to Kohana v3.x
Moving this to core since the issue was in the system message and not ORM