w3coded match value Stack Overflow for Teams w3coded match value Where developers & technologists w3coded match value share private knowledge with coworkers w3coded match value ,On the w3coded match value password reset form the user supplies w3coded match value current_password, password and w3coded match value password-confirmation. Is there a way to specify w3coded match value in the validation rules that current_password w3coded match value (it's hash value) must match the database w3coded match value value?,You can't, bcrypt hashes are unique (they w3coded match value have their own random salt incorporated) so even w3coded match value if you knew the user's plain text password you w3coded match value would't be able do a hash-to-hash w3coded match value comparison.,Connect and share knowledge within a w3coded match value single location that is structured and easy to w3coded match value search.
Currently I have this:
$rules = array(
'current_password' => 'required',
'password' => 'required|confirmed|min:22'
);
Thanks to @ChrisForrence and @Ben, I came up with the following which works great! Much appreciated. Hope this will help someone else:
Validator::extend('hashmatch', function($attribute, $value, $parameters)
{
return Hash::check($value, Auth::user()->$parameters[0]);
});
$messages = array(
'hashmatch' => 'Your current password must match your account password.'
);
$rules = array(
'current_password' => 'required|hashmatch:password',
'password' => 'required|confirmed|min:4|different:current_password'
);
$validation = Validator::make( Input::all(), $rules, $messages );
Last Update : 2023-09-22 UTC 14:14:32 PM
Last Update : 2023-09-22 UTC 14:14:25 PM
Last Update : 2023-09-22 UTC 14:14:06 PM
Last Update : 2023-09-22 UTC 14:13:54 PM
Last Update : 2023-09-22 UTC 14:13:37 PM
Last Update : 2023-09-22 UTC 14:13:09 PM
Last Update : 2023-09-22 UTC 14:12:54 PM