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

feat: insufficient validation for correct email in IonInput #30003

Open
3 tasks done
workfluo opened this issue Nov 6, 2024 · 0 comments
Open
3 tasks done

feat: insufficient validation for correct email in IonInput #30003

workfluo opened this issue Nov 6, 2024 · 0 comments
Labels

Comments

@workfluo
Copy link

workfluo commented Nov 6, 2024

Prerequisites

Describe the Feature Request

A validator for email that better checks if an email corresponds to basic requirements for an email.

Describe the Use Case

Currently is considered correct by the IonInput validator for email:
[alphanumeric chars]@[alphanumeric chars] (like 1@1 or a@a or a1@1a)
[alphanumeric chars]@[alphanumeric chars].oneAlphanumericChars (like [email protected] or [email protected]).

But an email must be based on a domain name which means it should end with a dot and a top-level domains (like .com, .tv, .berlin).

So to be validated an email should have:

  1. a dot after the sequence [alphanumeric chars]@[alphanumeric chars]
  2. then more than one alpha chars AND no numbers (TLDs haven't any numbers)

Describe Preferred Solution

There is actually a norm than define correct email: https://www.rfc-editor.org/rfc/rfc2822#section-3.4.1 .
2 Regex can help:

  • the simple one: /[^\s@]+@[^\s@]+.[^\s@]+/
  • the "RFC 2822: /(?:[a-z0-9+!#$%&'+/=?^_{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_{|}~-]+)|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])")@(?:(?:a-z0-9?.)+a-z0-9?|[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-][a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])+)])/i

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant