Skip to content
Advertisement

Laravel 5.2 New Password Must differ from Old One

Currently I am working on one project’s authentication module. I want to create functionality of password reset with the constraint that new password and old password must be different. But the problem is, the password is encrypted with bcrypt in database. So I can’t use Different validation rule on that field. I can accomplish it by creating additional function, but I want to do it with single validation with basic password validation like AlphaNum Between etc. Is it possible to do it without creating custom validation rule ? My code is following:

$data = Request::all();
$rules=array("username"=>"Required|Exists:users","password"=>"Required|AlphaNum|Between:6,64|Confirmed");

Thank you

Advertisement

Answer

laravel has reset password library.
It is very easy to use.
see it
resetting-passwords

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement