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

Email validation returning errors for valid emails in IE11 #38

Open
keirlawson opened this issue Jun 14, 2018 · 9 comments
Open

Email validation returning errors for valid emails in IE11 #38

keirlawson opened this issue Jun 14, 2018 · 9 comments

Comments

@keirlawson
Copy link

var schema = joi.object({
    sender: joi.string().email().required()
  })

joi.validate({sender: '[email protected]'}, schema)

This produces the following error: "child "sender" fails because ["sender" must be a valid email]" regardless of the email address in question on IE11 on Windows 10

@jeffbski
Copy link
Owner

@keirlawson see if the latest versions also do the same thing

@keirlawson
Copy link
Author

On the latest version (13.4.0) I now get Object doesn't support property or method 'normalize'

@Marsup
Copy link

Marsup commented Jun 15, 2018

You need to have a shim for String.normalize, should be fairly easy to add to your build.

@jeffbski
Copy link
Owner

jeffbski commented Jun 15, 2018

Thanks @Marsup!

@keirlawson in your project try installing the polyfill for String.prototype.normalize.

npm install unorm

Then just require it.

require('unorm'); // this will add normalize to the String prototype.

From compatibility tables, it looks like it is only necessary for IE and possibly Android.

See if that gets you working.

If so, we can add that to the documentation. I think we can just let users that need it add it in once at the app build level. If we build it into joi-browser then it doubles the gzip size from 44KB to 80KB.

@emmaberglund
Copy link

I have the same problem. My email doesn't become a valid email. I tried to install unorm but it still doesn't work.

@cjnqt
Copy link

cjnqt commented Sep 4, 2018

var schema = joi.object({ 
   sender: joi.string().email().required()
})

joi.validate({ sender: '[email protected]'}, schema)

This fails with the error "child "sender" fails because ["sender" must be a valid email]" in Internet Explorer 11 and latest version of both Joi-browser and Joi.

Adding String.normalize (require('unorm')) doesn't make any difference.

@nlucero
Copy link

nlucero commented Jan 29, 2020

Is this still an issue? Was it ever fixed?

@jeffbski
Copy link
Owner

jeffbski commented Feb 7, 2020

You could raise an issue in the source repo hapi/joi https://github.com/hapijs/joi This repo was just trying to make it easier to use in the browser. Now that they are planning on supporting browsers natively, the need for this repo will eventually go away. Hopefully the developers might know why this is failing.

@BasitMaqsood
Copy link

BasitMaqsood commented Apr 29, 2020

Joi-browser email validation allows user_email@gmail instead of [email protected], Any solution ???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants