diff --git a/apps/web/core/components/onboarding/steps/profile/root.tsx b/apps/web/core/components/onboarding/steps/profile/root.tsx index 90fc135d72..bd8a4c86ee 100644 --- a/apps/web/core/components/onboarding/steps/profile/root.tsx +++ b/apps/web/core/components/onboarding/steps/profile/root.tsx @@ -213,6 +213,11 @@ export const ProfileSetupStep: FC = observer(({ handleStepChange }) => { value: 24, message: "Name must be within 24 characters.", }, + validate: (value) => { + if (!/^[a-zA-Z0-9_-]+$/.test(value)) + return "First name can only contain letters, numbers, hyphens, and underscores."; + return true; + }, }} render={({ field: { value, onChange, ref } }) => ( { name="first_name" rules={{ required: "Please enter first name", + validate: (value) => { + if (!/^[a-zA-Z0-9_-]+$/.test(value)) + return "First name can only contain letters, numbers, hyphens, and underscores."; + return true; + }, }} render={({ field: { value, onChange, ref } }) => ( { { + if (!/^[a-zA-Z0-9_-]+$/.test(value)) + return "Last name can only contain letters, numbers, hyphens, and underscores."; + return true; + }, + }} render={({ field: { value, onChange, ref } }) => ( { /> )} /> + {errors?.last_name && {errors?.last_name?.message}}