setAttribute('password', $password); $rotated = Str::random(60); $user->setRememberToken($rotated); $user->save(); Event::dispatch(new PasswordReset($user)); } /** * Confirm the token was spent and the password replaced. * * @param string $response */ protected function sendResetResponse(Request $request, $response) { return response()->json(['message' => 'Password reset successfully.']); } /** * Refuse a token that did not check out. * * Quirk kept as is: unlike the JSON everything else on this prefix * answers with, the refusal is a bare plain-text body carrying a 403, so * a client parsing the reply has to special-case this one path. * * @param string $response */ protected function sendResetFailedResponse(Request $request, $response) { return response(self::REFUSED, Response::HTTP_FORBIDDEN); } }