Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lexstefan opened this issue Mar 8, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@lexstefan
Copy link

lexstefan commented Mar 8, 2024

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):

  • OS: Windows 11 / WSL
  • Browser: Firefox
  • Version: Latest

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 lexstefan added the bug Something isn't working label Mar 8, 2024
lexstefan added a commit to lexstefan/kirimase that referenced this issue Mar 8, 2024
@lexstefan
Copy link
Author

lexstefan commented Mar 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants