mirror of
https://github.com/documenso/documenso.git
synced 2025-11-11 04:52:41 +10:00
fix: add maxLength limits to document input fields (#1988)
This commit is contained in:
@ -28,6 +28,7 @@ export const ZDocumentTitleSchema = z
|
|||||||
export const ZDocumentExternalIdSchema = z
|
export const ZDocumentExternalIdSchema = z
|
||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
|
.max(255)
|
||||||
.describe('The external ID of the document.');
|
.describe('The external ID of the document.');
|
||||||
|
|
||||||
export const ZDocumentVisibilitySchema = z
|
export const ZDocumentVisibilitySchema = z
|
||||||
@ -65,10 +66,12 @@ export const ZDocumentMetaLanguageSchema = z
|
|||||||
|
|
||||||
export const ZDocumentMetaSubjectSchema = z
|
export const ZDocumentMetaSubjectSchema = z
|
||||||
.string()
|
.string()
|
||||||
|
.max(254)
|
||||||
.describe('The subject of the email that will be sent to the recipients.');
|
.describe('The subject of the email that will be sent to the recipients.');
|
||||||
|
|
||||||
export const ZDocumentMetaMessageSchema = z
|
export const ZDocumentMetaMessageSchema = z
|
||||||
.string()
|
.string()
|
||||||
|
.max(5000)
|
||||||
.describe('The message of the email that will be sent to the recipients.');
|
.describe('The message of the email that will be sent to the recipients.');
|
||||||
|
|
||||||
export const ZDocumentMetaDistributionMethodSchema = z
|
export const ZDocumentMetaDistributionMethodSchema = z
|
||||||
|
|||||||
@ -23,8 +23,8 @@ export const ZGetRecipientResponseSchema = ZRecipientSchema;
|
|||||||
* pass along required details.
|
* pass along required details.
|
||||||
*/
|
*/
|
||||||
export const ZCreateRecipientSchema = z.object({
|
export const ZCreateRecipientSchema = z.object({
|
||||||
email: z.string().toLowerCase().email().min(1),
|
email: z.string().toLowerCase().email().min(1).max(254),
|
||||||
name: z.string(),
|
name: z.string().max(255),
|
||||||
role: z.nativeEnum(RecipientRole),
|
role: z.nativeEnum(RecipientRole),
|
||||||
signingOrder: z.number().optional(),
|
signingOrder: z.number().optional(),
|
||||||
accessAuth: z.array(ZRecipientAccessAuthTypesSchema).optional().default([]),
|
accessAuth: z.array(ZRecipientAccessAuthTypesSchema).optional().default([]),
|
||||||
@ -33,8 +33,8 @@ export const ZCreateRecipientSchema = z.object({
|
|||||||
|
|
||||||
export const ZUpdateRecipientSchema = z.object({
|
export const ZUpdateRecipientSchema = z.object({
|
||||||
id: z.number().describe('The ID of the recipient to update.'),
|
id: z.number().describe('The ID of the recipient to update.'),
|
||||||
email: z.string().toLowerCase().email().min(1).optional(),
|
email: z.string().toLowerCase().email().min(1).max(254).optional(),
|
||||||
name: z.string().optional(),
|
name: z.string().max(255).optional(),
|
||||||
role: z.nativeEnum(RecipientRole).optional(),
|
role: z.nativeEnum(RecipientRole).optional(),
|
||||||
signingOrder: z.number().optional(),
|
signingOrder: z.number().optional(),
|
||||||
accessAuth: z.array(ZRecipientAccessAuthTypesSchema).optional().default([]),
|
accessAuth: z.array(ZRecipientAccessAuthTypesSchema).optional().default([]),
|
||||||
@ -103,8 +103,8 @@ export const ZSetDocumentRecipientsRequestSchema = z
|
|||||||
recipients: z.array(
|
recipients: z.array(
|
||||||
z.object({
|
z.object({
|
||||||
nativeId: z.number().optional(),
|
nativeId: z.number().optional(),
|
||||||
email: z.string().toLowerCase().email().min(1),
|
email: z.string().toLowerCase().email().min(1).max(254),
|
||||||
name: z.string(),
|
name: z.string().max(255),
|
||||||
role: z.nativeEnum(RecipientRole),
|
role: z.nativeEnum(RecipientRole),
|
||||||
signingOrder: z.number().optional(),
|
signingOrder: z.number().optional(),
|
||||||
actionAuth: z.array(ZRecipientActionAuthTypesSchema).optional().default([]),
|
actionAuth: z.array(ZRecipientActionAuthTypesSchema).optional().default([]),
|
||||||
@ -229,8 +229,8 @@ export const ZCompleteDocumentWithTokenMutationSchema = z.object({
|
|||||||
authOptions: ZRecipientActionAuthSchema.optional(),
|
authOptions: ZRecipientActionAuthSchema.optional(),
|
||||||
nextSigner: z
|
nextSigner: z
|
||||||
.object({
|
.object({
|
||||||
email: z.string().email(),
|
email: z.string().email().max(254),
|
||||||
name: z.string().min(1),
|
name: z.string().min(1).max(255),
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
});
|
});
|
||||||
|
|||||||
@ -83,8 +83,8 @@ export const ZCreateTemplateMutationSchema = z.object({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const ZCreateDocumentFromDirectTemplateRequestSchema = z.object({
|
export const ZCreateDocumentFromDirectTemplateRequestSchema = z.object({
|
||||||
directRecipientName: z.string().optional(),
|
directRecipientName: z.string().max(255).optional(),
|
||||||
directRecipientEmail: z.string().email(),
|
directRecipientEmail: z.string().email().max(254),
|
||||||
directTemplateToken: z.string().min(1),
|
directTemplateToken: z.string().min(1),
|
||||||
directTemplateExternalId: z.string().optional(),
|
directTemplateExternalId: z.string().optional(),
|
||||||
signedFieldValues: z.array(ZSignFieldWithTokenMutationSchema),
|
signedFieldValues: z.array(ZSignFieldWithTokenMutationSchema),
|
||||||
@ -97,8 +97,8 @@ export const ZCreateDocumentFromTemplateRequestSchema = z.object({
|
|||||||
.array(
|
.array(
|
||||||
z.object({
|
z.object({
|
||||||
id: z.number().describe('The ID of the recipient in the template.'),
|
id: z.number().describe('The ID of the recipient in the template.'),
|
||||||
email: z.string().email(),
|
email: z.string().email().max(254),
|
||||||
name: z.string().optional(),
|
name: z.string().max(255).optional(),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.describe('The information of the recipients to create the document with.')
|
.describe('The information of the recipients to create the document with.')
|
||||||
|
|||||||
@ -221,6 +221,7 @@ export const AddSettingsFormPartial = ({
|
|||||||
className="bg-background"
|
className="bg-background"
|
||||||
{...field}
|
{...field}
|
||||||
disabled={document.status !== DocumentStatus.DRAFT || field.disabled}
|
disabled={document.status !== DocumentStatus.DRAFT || field.disabled}
|
||||||
|
maxLength={255}
|
||||||
onBlur={handleAutoSave}
|
onBlur={handleAutoSave}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|||||||
@ -690,6 +690,7 @@ export const AddSignersFormPartial = ({
|
|||||||
}
|
}
|
||||||
data-testid="signer-email-input"
|
data-testid="signer-email-input"
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
|
maxLength={254}
|
||||||
onBlur={handleAutoSave}
|
onBlur={handleAutoSave}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -728,6 +729,7 @@ export const AddSignersFormPartial = ({
|
|||||||
!canRecipientBeModified(signer.nativeId)
|
!canRecipientBeModified(signer.nativeId)
|
||||||
}
|
}
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
|
maxLength={255}
|
||||||
onBlur={handleAutoSave}
|
onBlur={handleAutoSave}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|||||||
@ -262,7 +262,7 @@ export const AddSubjectFormPartial = ({
|
|||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} maxLength={254} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -300,7 +300,7 @@ export const AddSubjectFormPartial = ({
|
|||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} maxLength={255} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
@ -326,7 +326,11 @@ export const AddSubjectFormPartial = ({
|
|||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Textarea className="bg-background mt-2 h-16 resize-none" {...field} />
|
<Textarea
|
||||||
|
className="bg-background mt-2 h-16 resize-none"
|
||||||
|
{...field}
|
||||||
|
maxLength={5000}
|
||||||
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|||||||
@ -627,6 +627,7 @@ export const AddTemplatePlaceholderRecipientsFormPartial = ({
|
|||||||
signers[index].email === user?.email ||
|
signers[index].email === user?.email ||
|
||||||
isSignerDirectRecipient(signer)
|
isSignerDirectRecipient(signer)
|
||||||
}
|
}
|
||||||
|
maxLength={254}
|
||||||
onBlur={handleAutoSave}
|
onBlur={handleAutoSave}
|
||||||
data-testid="placeholder-recipient-email-input"
|
data-testid="placeholder-recipient-email-input"
|
||||||
/>
|
/>
|
||||||
@ -663,6 +664,7 @@ export const AddTemplatePlaceholderRecipientsFormPartial = ({
|
|||||||
signers[index].email === user?.email ||
|
signers[index].email === user?.email ||
|
||||||
isSignerDirectRecipient(signer)
|
isSignerDirectRecipient(signer)
|
||||||
}
|
}
|
||||||
|
maxLength={255}
|
||||||
onBlur={handleAutoSave}
|
onBlur={handleAutoSave}
|
||||||
data-testid="placeholder-recipient-name-input"
|
data-testid="placeholder-recipient-name-input"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -216,7 +216,7 @@ export const AddTemplateSettingsFormPartial = ({
|
|||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input className="bg-background" {...field} onBlur={handleAutoSave} />
|
<Input className="bg-background" {...field} maxLength={255} onBlur={handleAutoSave} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
@ -519,7 +519,7 @@ export const AddTemplateSettingsFormPartial = ({
|
|||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} maxLength={254} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -539,7 +539,7 @@ export const AddTemplateSettingsFormPartial = ({
|
|||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} onBlur={handleAutoSave} />
|
<Input {...field} maxLength={254} onBlur={handleAutoSave} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -569,6 +569,7 @@ export const AddTemplateSettingsFormPartial = ({
|
|||||||
<Textarea
|
<Textarea
|
||||||
className="bg-background h-16 resize-none"
|
className="bg-background h-16 resize-none"
|
||||||
{...field}
|
{...field}
|
||||||
|
maxLength={5000}
|
||||||
onBlur={handleAutoSave}
|
onBlur={handleAutoSave}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -623,7 +624,7 @@ export const AddTemplateSettingsFormPartial = ({
|
|||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input className="bg-background" {...field} onBlur={handleAutoSave} />
|
<Input className="bg-background" {...field} maxLength={255} onBlur={handleAutoSave} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -714,7 +715,7 @@ export const AddTemplateSettingsFormPartial = ({
|
|||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input className="bg-background" {...field} onBlur={handleAutoSave} />
|
<Input className="bg-background" {...field} maxLength={255} onBlur={handleAutoSave} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|||||||
Reference in New Issue
Block a user