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

Issue with Email Sign-Up Due to "+" Character #333

Closed
ollebergkvist opened this issue Dec 29, 2023 · 8 comments
Closed

Issue with Email Sign-Up Due to "+" Character #333

ollebergkvist opened this issue Dec 29, 2023 · 8 comments
Assignees
Labels
question Further information is requested workaround Workaround fixes problem

Comments

@ollebergkvist
Copy link

ollebergkvist commented Dec 29, 2023

We recently received a support ticket from a client who faced difficulties signing up for our app because their email contained a "+". The valibot validation for the email() method prevented the sign-up process.

I'm aware that many email providers do not permit the use of the "+" character. However, I'd like to highlight that reputable providers, such as ProtonMail, now allow its usage in email addresses (https://proton.me/mail).

@ariskemper
Copy link
Contributor

@ollebergkvist could you provide more context, because valibot supports email in format like [email protected] ?

@fabian-hiller
Copy link
Owner

Thank you for creating this issue. I will take a look at it once we have more details. As a workaround, you can use one of these regex along with our regex validation function:

W3C Working Draft Regex from w3.org:

/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/

HTML Standard Regex from whatwg.org:

/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/

@fabian-hiller fabian-hiller self-assigned this Dec 29, 2023
@fabian-hiller fabian-hiller added question Further information is requested workaround Workaround fixes problem labels Dec 29, 2023
@sqmasep
Copy link
Contributor

sqmasep commented Dec 29, 2023

@ollebergkvist could you provide more context, because valibot supports email in format like [email protected] ?

It seems that it doesn't work when a + is at the end of the input. If i'm not mistaken, some emails allow this, so that might be the problem

@fabian-hiller
Copy link
Owner

Thanks for the info. That could be the problem. Let's wait for @ollebergkvist's reply.

@fabian-hiller
Copy link
Owner

And maybe take a look at issue #204 to understand why email intentionally does not accept every valid email address.

@ariskemper
Copy link
Contributor

@sqmasep @fabian-hiller i added a test here #276 and, it is working for + in the begining and ending of local part. Maybe it is no the issue in '+'character @ollebergkvist? So we would need more context on it.

@ollebergkvist
Copy link
Author

ollebergkvist commented Jan 2, 2024

Sorry, I've been away for a couple of days.

The email that triggers the error is:
[email protected]

Running:
"valibot": "^0.19.0",

@ollebergkvist
Copy link
Author

I invested additional time in debugging the problem. The validation error triggered by valibot for emails with a '+' symbol didn't occur due to the validation process rejecting emails containing '+'. Instead, the issue stemmed from our oversight in encoding/decoding the query parameter passed to valibot. Consequently, valibot misinterpreted the '+' symbol as a space.

Thanks and sorry for the false alarm here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested workaround Workaround fixes problem
Projects
None yet
Development

No branches or pull requests

4 participants