Bug Report #4432

Fix 'password confirm' error message in ORM module

Added by Richard Willis over 2 years ago. Updated almost 2 years ago.

Status:ClosedStart date:02/07/2012
Priority:NormalDue date:
Assignee:Lorenzo Pisani% 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.


Related issues

Related to Kohana v3.x - Bug Report #3896: Error message for 'password confirm' is incorrect in Auth... Closed 03/31/2011

History

#1 Updated by Richard Willis over 2 years 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

#2 Updated by Lorenzo Pisani over 2 years ago

  • Project changed from Kohana v3.x to ORM

#3 Updated by Isaiah DeRose-Wilson over 2 years ago

  • Status changed from New to Assigned
  • Assignee set to Isaiah DeRose-Wilson
  • Target version set to v3.3.0
  • Points deleted (1)

#4 Updated by Lorenzo Pisani almost 2 years 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.

#5 Updated by Lorenzo Pisani almost 2 years ago

  • Project changed from ORM to Kohana v3.x

Moving this to core since the issue was in the system message and not ORM

#6 Updated by Lorenzo Pisani 6 months ago

  • Related to Bug Report #3896: Error message for 'password confirm' is incorrect in Auth module added

Also available in: Atom PDF