feat: Add validation for donateAccount endpoint

This commit is contained in:
rensumo
2026-02-22 11:12:35 +08:00
parent 04443bcb5e
commit 07c650a474

View File

@@ -485,6 +485,10 @@ public class ParserApi {
*/ */
@RouteMapping(value = "/donateAccount", method = RouteMethod.POST) @RouteMapping(value = "/donateAccount", method = RouteMethod.POST)
public Future<JsonObject> donateAccount(HttpServerRequest request, JsonObject body) { public Future<JsonObject> donateAccount(HttpServerRequest request, JsonObject body) {
if (body == null || StringUtils.isBlank(body.getString("panType"))
|| StringUtils.isBlank(body.getString("authType"))) {
return Future.succeededFuture(JsonResult.error("panType and authType are required").toJsonObject());
}
String ip = request.remoteAddress().host(); String ip = request.remoteAddress().host();
body.put("ip", ip); body.put("ip", ip);
return dbService.saveDonatedAccount(body); return dbService.saveDonatedAccount(body);