Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP 3 - Compare passwords

I have two field "password" (This field is in the database) and confirm_password (This field is not in the database)

Well, I need to compare if password == confirm_password.. but I'm not knowing create a custom validation to "confirm_password"... Would need to have this field in the database?

How do I do?

like image 369
TMoraes Avatar asked Feb 09 '15 02:02

TMoraes


1 Answers

Now there has a method call sameAs in validator class, for version 3.2 or grater.

 $validator -> sameAs('password_match','password','Passwords not equal.');

see API

like image 104
Alimon Karim Avatar answered Oct 16 '22 07:10

Alimon Karim