Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/features/Auth/v1/hooks/useSignupForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { z } from "zod";

export const signupSchema = z
.object({
communityName: z.string().min(2, "Community name must be at least 2 characters"),
communityBio: z.string().min(10, "Bio must be at least 10 characters"),
communityName: z.string().min(2, "Community name must be at least 2 characters").max(100, "Community name must not exceed 100 characters"),
communityBio: z.string().min(10, "Bio must be at least 10 characters").max(500, "Bio must not exceed 500 characters"),
Comment on lines +7 to +8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It is recommended to trim whitespace from the input strings before validating their length. Without .trim(), users can bypass the minimum length requirements by entering spaces, or accidentally include leading/trailing spaces that count towards the maximum length limit.

Suggested change
communityName: z.string().min(2, "Community name must be at least 2 characters").max(100, "Community name must not exceed 100 characters"),
communityBio: z.string().min(10, "Bio must be at least 10 characters").max(500, "Bio must not exceed 500 characters"),
communityName: z.string().trim().min(2, "Community name must be at least 2 characters").max(100, "Community name must not exceed 100 characters"),
communityBio: z.string().trim().min(10, "Bio must be at least 10 characters").max(500, "Bio must not exceed 500 characters"),

communityLogo: z.string().optional(),
communityWebsite: z
.string()
Expand Down