Skip to content

Commit 1646335

Browse files
fix: signup input validation
Co-authored-by: rare1k <[email protected]>
1 parent acff8dd commit 1646335

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/app/auth/signup/page.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ export default async function Page(props: {
5151
});
5252
const users = await db.select().from(user);
5353
if (userCheck) redirect("/auth/login?error=Email%20already%20in%20use");
54+
const email = data.get("email")?.toString() || "";
55+
const name = data.get("name")?.toString() || "";
56+
if (!["@", "."].includes(email) || [" ", "%", "!", "$", "%", "&", "<", ">", "/", "\\"].includes(email)) {
57+
redirect("/auth/signup?error=Bad%20email");
58+
}
59+
if (email.length >= 64 || email.length >= 64 || email.length <= 7 || name.length <= 3) {
60+
redirect("/auth/signup?error=Bad%20email%20or%20name");
61+
}
5462
await db.insert(user).values({
5563
name: data.get("name")?.toString(),
5664
email: data.get("email")?.toString() as string,

0 commit comments

Comments
 (0)