Giter Site home page Giter Site logo

Comments (7)

BBosman avatar BBosman commented on May 28, 2024 1

Technically test@ai is a valid email address.

It's called a dotless domain.

But they're rare and advised against by ICANN (among others), so you could indeed argue that calling them not valid makes more sense.

from aurelia.

Sayan751 avatar Sayan751 commented on May 28, 2024 1

Note that this email pattern is similar to what is there for au1, and only provides a rudimentary email validation. An actual RFC 5322, and RFC 6532 compliant email address parser is a non-trivial job, and IMO is immensely difficult to handle only using regex (disclaimer: I wrote a parser). I think that it is best to remove this OOTB rule from the validation package, so that devs can choose a fitting parser for email-address validation.

from aurelia.

Swarga-codes avatar Swarga-codes commented on May 28, 2024

Can we use npm package validator.js to fix the issue?

from aurelia.

aniketkumar7 avatar aniketkumar7 commented on May 28, 2024

Yes, I think emailPattern does not enforce the presence of a top-level domain (TLD) at the end of the email address. This causes emails like test@test to be considered valid, even though they are missing a TLD (e.g., .com, .net, .org, etc.).

To fix this issue, the updated emailPattern adds .[a-zA-Z0-9]{2,} at the end of the regular expression.
Is this enough?
Can I contribute/change it?

from aurelia.

Sayan751 avatar Sayan751 commented on May 28, 2024

Can we use npm package validator.js to fix the issue?

@Swarga-codes The general idea is not to create dependency on third party library when it is avoidable. However, if there is a separate package that integrates the @aurelia/validation with a third party library like validator.js (something like @aurelia/validation-validator-js), I have nothing against that. @bigopon What do you think?

Can I contribute/change it?

@aniketkumar7 Please feel free. Thank you for expressing your interest. However, as I have expressed before, my preference would be to remove the email rule, so that devs can choose a more competent email-address validation library as per their preference. An RFC compliant validation of email addresses is a very hard job for a regex.

from aurelia.

bigopon avatar bigopon commented on May 28, 2024

integrates the @aurelia/validation with a third party library

We cannot cover all libraries, and providing an official one with a library will limit the potential of others, I think we should have a doc section for integration instead. It's harder to keep it up to date, but these libraries shouldn't change too fast, at least for now.

from aurelia.

Sayan751 avatar Sayan751 commented on May 28, 2024

So we agree on removing the email rule 😛

I think we should have a doc section for integration instead.

We already have: https://docs.aurelia.io/aurelia-packages/validation/defining-rules#associating-validation-rules-with-property

image

from aurelia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.