How do I run validation checks on a password field in CakePHP, seeing that the password is hashed before I get a chance to run any checks on it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you only have a single
passwordfield in your form, you will need to create a custom hash function that either does nothing, or, better, preserves the original password somewhere.Most likely though you have two password fields in your form where the user is required to confirm the password. In this case, you perform your password validation rules on the second password field. This can automatically happen in a custom validation rule, remember that you have access to all other fields inside a validation function via
$this->data. You can then confirm that the two passwords are identical as described here.