ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.11k stars 13.5k forks source link

feat: insufficient validation for correct email in IonInput #30003

Open workfluo opened 2 weeks ago

workfluo commented 2 weeks ago

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 1@1.a or a@1.1).

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:

Describe Alternatives

No response

Related Code

No response

Additional Information

No response