nicoalbanese / kirimase

Build full-stack Next.js apps, incredibly fast
https://kirimase.dev
MIT License
2.57k stars 118 forks source link

[ISSUE] emails can be larger than 31 characters and still be legitimate #163

Closed lexstefan closed 2 months ago

lexstefan commented 6 months ago

Config File

{
  "hasSrc": true,
  "packages": [
    "shadcn-ui",
    "drizzle",
    "lucia"
  ],
  "preferredPackageManager": "npm",
  "t3": false,
  "alias": "@",
  "analytics": true,
  "rootPath": "src/",
  "componentLib": "shadcn-ui",
  "driver": "sqlite",
  "provider": "turso",
  "orm": "drizzle",
  "auth": "lucia"
}

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior I expect to not get Invalid Email error when creating an account / signing in.

Screenshots

export const authenticationSchema = z.object({
  email: z.string().email().min(5).max(31),
  password: z
    .string()
    .min(4, { message: "must be at least 4 characters long" })
    .max(15, { message: "cannot be more than 15 characters long" }),
});

Desktop (please complete the following information):

Additional context Public emails can be larger than expected, mainly because people with the same name got them before. Thus someone might have an email like: contact.doctor.rages.koothrappali@gmail.com [43 characters] and still be legitimate. To be safe, i'd set 64 characters to be absolute max.

lexstefan commented 6 months ago

P.S.:

Local Part: The local part of an email address can have a maximum length of 64 characters. Domain Part: The domain part of an email address can have a maximum length of 255 characters. When you combine the local and domain parts, the maximum length of a complete email address is 320 characters.

Zod validates local part of email & domain name together. Thus local + domain name adding up to 64 characters is reasonable.

lexstefan commented 2 months ago

👍 🥳