From bcf60a489059a809a796d1628d00b1c60018f4d5 Mon Sep 17 00:00:00 2001 From: Illya9999 <65667527+Illya9999@users.noreply.github.com> Date: Mon, 31 Oct 2022 13:50:00 -0400 Subject: [PATCH] Only allow numbers as discrim (#1085) --- app/routes/u.$identifier/edit.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/routes/u.$identifier/edit.tsx b/app/routes/u.$identifier/edit.tsx index 47735d661..120eaee47 100644 --- a/app/routes/u.$identifier/edit.tsx +++ b/app/routes/u.$identifier/edit.tsx @@ -96,7 +96,11 @@ const userEditActionSchema = z ), inGameNameDiscriminator: z.preprocess( falsyToNull, - z.string().length(USER.IN_GAME_NAME_DISCRIMINATOR_LENGTH).nullable() + z + .string() + .length(USER.IN_GAME_NAME_DISCRIMINATOR_LENGTH) + .refine((val) => /^[0-9]{4}$/.test(val)) + .nullable() ), }) .refine(