validate( ['password' => ['required', 'string', 'max:64', 'confirmed', ClientPassword::rule()]], ['password.min' => ClientPassword::minMessage()], ); $hosting = Service::with('hostingAccount.server') ->where('uuid', $uuid) ->where('customer_id', $request->user()->id) ->where('status', 'active') ->first()?->hostingAccount; $client = $hosting ? ModuleHostingPleskClient::forHosting($hosting) : null; if (!$client || !$hosting->server) { return response()->json(['error' => true, 'message' => 'Không tìm thấy dịch vụ hosting'], 404); } if (!$plesk->changePassword($hosting->server, $client, $data['password'])) { return response()->json(['error' => true, 'message' => 'Plesk từ chối mật khẩu mới. Hãy dùng mật khẩu mạnh hơn (chữ hoa, chữ thường, số, ký tự đặc biệt).'], 422); } return response()->json(['error' => false, 'message' => 'Đã đổi mật khẩu Plesk']); } }