Laravel 4.2 Validation Rules - Current Password Must Match DB Value


Last Update : 2023-09-22 UTC 10:25:37 AM

Answers of > Laravel 4.2 Validation Rules - Current Password Must Match DB Value

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 );

Current topics : Laravel 4.2 Validation Rules - Current Password Must Match DB Value

Newly Added Questions

Similar Questions

Questions :

How To Group Array Key Value

Last Update : 2023-09-22 UTC 14:14:39 PM

Questions :

PhpStorm Warning For React Attributes In Jsx File With SCSS File

Last Update : 2023-09-22 UTC 14:14:32 PM

Questions :

Why Is The File Not Showing Up In Request.files And In Request.forms Instead?

Last Update : 2023-09-22 UTC 14:14:25 PM

Questions :

Proxying Assets From React App Directory In Slim Framework?

Last Update : 2023-09-22 UTC 14:14:06 PM

Questions :

Laravel 5.4 Can't Run “php Artisan Preset React” Comand

Last Update : 2023-09-22 UTC 14:13:54 PM

Questions :

How To Update Session Values Without Signing Out?

Last Update : 2023-09-22 UTC 14:13:37 PM

Questions :

Array Is Not Visible

Last Update : 2023-09-22 UTC 14:13:19 PM

Questions :

React Routing For Login Using Symfony

Last Update : 2023-09-22 UTC 14:13:14 PM

Questions :

Sanctum With React SPA Returning 419 Page Expired

Last Update : 2023-09-22 UTC 14:13:09 PM

Questions :

How Do I Import An Input String Into Another Page

Last Update : 2023-09-22 UTC 14:12:54 PM

© 2023 W3CODED - All Rights Reserved.