From 1d6f7f9e37780827cd2d26e8efc5a2c80338c11a Mon Sep 17 00:00:00 2001 From: Aditya Deshlahre <132184385+adityadeshlahre@users.noreply.github.com> Date: Thu, 19 Oct 2023 06:42:56 +0530 Subject: [PATCH] fix(bug): name field can be updated with spaces #555 (#558) --- apps/web/src/app/(signing)/sign/[token]/form.tsx | 2 +- apps/web/src/app/(signing)/sign/[token]/name-field.tsx | 2 +- packages/trpc/server/field-router/schema.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/src/app/(signing)/sign/[token]/form.tsx b/apps/web/src/app/(signing)/sign/[token]/form.tsx index 36a54879c..17872a7ab 100644 --- a/apps/web/src/app/(signing)/sign/[token]/form.tsx +++ b/apps/web/src/app/(signing)/sign/[token]/form.tsx @@ -99,7 +99,7 @@ export const SigningForm = ({ document, recipient, fields }: SigningFormProps) = id="full-name" className="bg-background mt-2" value={fullName} - onChange={(e) => setFullName(e.target.value)} + onChange={(e) => setFullName(e.target.value.trimStart())} /> diff --git a/apps/web/src/app/(signing)/sign/[token]/name-field.tsx b/apps/web/src/app/(signing)/sign/[token]/name-field.tsx index 275a6ede8..bbe18fb8a 100644 --- a/apps/web/src/app/(signing)/sign/[token]/name-field.tsx +++ b/apps/web/src/app/(signing)/sign/[token]/name-field.tsx @@ -125,7 +125,7 @@ export const NameField = ({ field, recipient }: NameFieldProps) => { type="text" className="mt-2" value={localFullName} - onChange={(e) => setLocalFullName(e.target.value)} + onChange={(e) => setLocalFullName(e.target.value.trimStart())} /> diff --git a/packages/trpc/server/field-router/schema.ts b/packages/trpc/server/field-router/schema.ts index d6c3f90b2..051636477 100644 --- a/packages/trpc/server/field-router/schema.ts +++ b/packages/trpc/server/field-router/schema.ts @@ -3,7 +3,7 @@ import { z } from 'zod'; export const ZSignFieldWithTokenMutationSchema = z.object({ token: z.string(), fieldId: z.number(), - value: z.string(), + value: z.string().trim(), isBase64: z.boolean().optional(), });