fix(api): mc_uuid 统一校验为 UUID,非法值返回 400 bad_mc_uuid 并按规范形式存储
This commit is contained in:
13 files changed
+159
-35
No files matched your search
@@ -438,6 +438,12 @@ describe("api access-control wire shapes", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("says what a Minecraft UUID looks like when the typed one is not", () => {
|
||||
expect(humanizeError({ status: 400, code: "bad_mc_uuid" })).toBe(
|
||||
"That isn't a Minecraft UUID. It looks like 069a79f4-44e9-4726-a5be-fca90e38aaf5, with or without the dashes.",
|
||||
);
|
||||
});
|
||||
|
||||
it("says email codes are off when the install has no mail relay", async () => {
|
||||
const { humanizeError } = await import("./api");
|
||||
expect(humanizeError({ status: 503, code: "mail_unavailable" })).toBe(
|
||||
|
||||
@@ -1002,6 +1002,8 @@ export function humanizeError(e: unknown): string {
|
||||
return t("invalid_code");
|
||||
case "already_linked":
|
||||
return t("already_linked");
|
||||
case "bad_mc_uuid":
|
||||
return t("bad_mc_uuid");
|
||||
case "otp_resend_cooldown":
|
||||
return t("otp_resend_cooldown");
|
||||
case "otp_locked":
|
||||
|
||||
@@ -3427,6 +3427,7 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
400: components["responses"]["BadRequest"];
|
||||
401: components["responses"]["Unauthorized"];
|
||||
};
|
||||
};
|
||||
@@ -3491,6 +3492,7 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
400: components["responses"]["BadRequest"];
|
||||
401: components["responses"]["Unauthorized"];
|
||||
};
|
||||
};
|
||||
@@ -3615,6 +3617,7 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
400: components["responses"]["BadRequest"];
|
||||
401: components["responses"]["Unauthorized"];
|
||||
};
|
||||
};
|
||||
@@ -6651,6 +6654,7 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
400: components["responses"]["BadRequest"];
|
||||
401: components["responses"]["Unauthorized"];
|
||||
403: components["responses"]["Forbidden"];
|
||||
/** @description No linked account for this UUID. */
|
||||
|
||||
Reference in new issue
Block a user