I want to create a validation to a form that resets the password.
I have a method that checks whether the new password are the same and have more than 6 characters.
I miss only one thing to check if given the previous password is consistent.
/**
* Reset user password
*
* @return void
*/
public function reset_password(Request $request){
$this->validate($request, [
'old_password' => 'required',
'password' => 'required|min:6|confirmed'
]);
$user = Auth::user();
$user->password = bcrypt($request->password);
$user->save();
return redirect('/user/profile');
}
via chmod