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 doesn't allow emails which are compliant with RFC 6530 #931

Closed
antony opened this issue Jun 20, 2016 · 17 comments
Closed
Assignees
Labels
feature New functionality or improvement
Milestone

Comments

@antony
Copy link

antony commented Jun 20, 2016

Context

  • node version: 5.11.1
  • joi version: 8.4.2
  • environment (node, browser): Node
  • used with (hapi, standalone, ...): Hapi
  • any other relevant information:

What are you trying to achieve or the steps to reproduce ?

  1. Attempt to validate a utf-8 email address such as: jØrgen@somedomain.com
  2. Get 'invalid' validation result

Note that this email is considered invalid, which is correct, but permitted by https://tools.ietf.org/html/rfc6530

const schema = Joi.string().email()

Which result you had ?

Email address was marked as invalid. This is a problem as I would now have to use a regexp or simple string validation for email addresses which significantly reduces readability.

What did you expect ?

I'd hope for some method of switching between RFC versions - perhaps by passing in the rfc number. I don't really have any other 'good solutions' for this.

Google, for example support sending and recieving from RFC 6530 emails, but not signing up with them - they would use something like:

const signupSchema = Joi.string().email({compliance: 'rfc5322'})
const sendingSchema = Joi.string().email({compliance: 'rfc6530'})

Of course compliance could be changed to international: true/false' or something similar, but I think compliance is more explicit.

@Marsup
Copy link
Collaborator

Marsup commented Jun 20, 2016

This should probably be brought up in https://github.com/hapijs/isemail, but leave this one opened so I can trace it.

@antony
Copy link
Author

antony commented Jun 20, 2016

Hadn't noticed, this has already been raised here: skeggse/isemail#17

@Marsup
Copy link
Collaborator

Marsup commented Jun 20, 2016

Ha, sorry for misdirecting you :)

@WesTyler
Copy link
Contributor

isemail v3.0.0 has been released, with proper Unicode support. I made a PR here to update Joi to use it. That should resolve this once and for all ;)

@skeggse
Copy link

skeggse commented Jun 23, 2017

Oh funny, I'd never seen this issue. Interesting idea with the compliance parameter.

@Marsup
Copy link
Collaborator

Marsup commented Jun 24, 2017

As far as I understand, both RFCs will be enabled once I release the next joi version, but this request still stands as it could be interesting to be able to pick and choose whether internationalized emails should be allowed. I think this again falls onto isemail to support that, right @skeggse ?

@WesTyler
Copy link
Contributor

pick and choose whether internationalized emails should be allowed

why is that?

@Marsup
Copy link
Collaborator

Marsup commented Jun 24, 2017

Because user constraints. There are 2 RFCs, I can imagine systems not being ready to accept both.

@DavidTPate
Copy link
Contributor

I can imagine systems not being ready to accept both.

I've definitely run into this in the past. A simple thing for this might be you use DynamoDB to store email addresses which doesn't support the full set of internationalized characters (without escaping them) so you want to ensure that you have only valid characters.

@WesTyler
Copy link
Contributor

Is this a requirement prior to releasing international email via isemail@3.x.x?

@Marsup
Copy link
Collaborator

Marsup commented Jun 26, 2017

I'd tend to say so, as joi would start accepting emails it didn't previously.

@WesTyler
Copy link
Contributor

skeggse/isemail#156

@skeggse
Copy link

skeggse commented Jan 29, 2018

This is an option in isemail now, as of 3.1.0. See skeggse/isemail#160 (thanks, @papandreou!)

@ErickWendel
Copy link

Guys, you can close this issue? Apparently is solved :shipit:

@skeggse
Copy link

skeggse commented Mar 22, 2018

Has Joi updated to the latest isemail?

@AdriVanHoudt
Copy link
Contributor

It takes 3.x so I guess yes https://github.com/hapijs/joi/blob/master/package.json#L18 🚀

@Marsup Marsup added this to the 11.0.0 milestone Mar 22, 2018
@Marsup Marsup self-assigned this Mar 22, 2018
@Marsup Marsup closed this as completed Mar 22, 2018
@hueniverse hueniverse added feature New functionality or improvement and removed request labels Sep 19, 2019
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality or improvement
Projects
None yet
Development

No branches or pull requests

8 participants