lundi 15 juin 2020

I get error reset password, can you help me!, thanks

"message": "Too few arguments to function App\\Http\\Controllers\\Api\\ResetPasswordController::reset(), 1 passed and exactly 2 expected",

public function reset(Request $request, $token)
{
    $this->validate($request,[

        'email' => 'required|email', 
        'password' => 'required|confrimed',
        'token' => 'required|string',



    ]);

    $passwordreset = PasswordReset::where([
        ['token' => $request->token],
        ['email' => $request->email]
    ])->first();

    if(! $passwordreset)
        return response()->json([
            'message' => 'This password reset is invalid'
        ], 404);

    $user = User::where(
        'email', $passwordreset->email
    )->first();
    if(!$user)
        return response()->json([
            'message' => 'we cant find user email addrsss!'
        ], 404); 

        $user->password = bcrypt($request->password);
        $user->save();

        $passwordreset->delete();
        $user->notify(new PasswordResetSuccess($passwordreset));

        return response()->json($user);
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire