Skip to content

Commit b491a42

Browse files
Merge pull request #221 from udaycodespace/fix/auth-schema-max-length-209
fix(validation): add missing max length constraints to auth schemas
2 parents 48ac0ac + 3bf6766 commit b491a42

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

packages/common/src/utils/input.validation.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,35 @@ module.exports.signupSchema = z.object({
3636
});
3737

3838
module.exports.changePasswordSchema = z.object({
39-
currentPassword: z.string().min(1, "Current password is required"),
40-
newPassword: z.string().min(6, "New password must be at least 6 characters"),
39+
currentPassword: z
40+
.string()
41+
.min(1, "Current password is required")
42+
.max(100, "Password is too long."),
43+
newPassword: z
44+
.string()
45+
.min(6, "New password must be at least 6 characters")
46+
.max(100, "Password is too long."),
4147
});
4248

4349
module.exports.deleteAccountSchema = z.object({
44-
password: z.string().min(1, "Password is required"),
50+
password: z
51+
.string()
52+
.min(1, "Password is required")
53+
.max(100, "Password is too long."),
4554
});
4655

4756
module.exports.onlyEmailSchema = z.object({
48-
email: z.string().email("Invalid email format"),
57+
email: z
58+
.string()
59+
.email("Invalid email format")
60+
.max(100, "Email is too long."),
4961
});
5062

5163
module.exports.verifyOtpSchema = z.object({
52-
email: z.string().email("Invalid email format"),
64+
email: z
65+
.string()
66+
.email("Invalid email format")
67+
.max(100, "Email is too long."),
5368
otp: z.string().length(6, "OTP must be 6 digits"),
5469
});
5570

0 commit comments

Comments
 (0)