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 addresses with apostrophes in aren't accepted as valid. #732

Open
oharab opened this issue Aug 30, 2017 · 2 comments
Open

Email addresses with apostrophes in aren't accepted as valid. #732

oharab opened this issue Aug 30, 2017 · 2 comments

Comments

@oharab
Copy link

oharab commented Aug 30, 2017

When creating a new account and the user has an apostrophe in their name, the user validation fails and the user can't be created.
bonobo_email_error
The address is valid, as per RFC 2822, I can't be the only Irishman who struggles with this, daily?

@willdean
Copy link
Collaborator

@oharab Thanks for this.

I'd like to say it was a conspiracy by the English to further oppress those from The Land of the Bogs and the Little People, but sadly I think it predates any English involvement in the project, so on this point we're blameless.

The current email validation regex is @"^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,63}$"

I think this could actually be simplified by replacing [A-Za-z0-9] with something more inclusive (far more chars are allowed, as you point out), which would get rid of the need for some of the repetition.

Do you feel like suggesting a better regex?

@oharab
Copy link
Author

oharab commented Aug 31, 2017

Based on info at http://www.regular-expressions.info/email.html how about:
^[A-Z0-9]['A-Z0-9._%+-]{0,63}@(?:[A-Z0-9-]{1,63}.){1,125}[A-Z]{2,63}$`

I've tested it online and it works with my address and some others I tried out.
Once caveat I'm sure you're aware of is that if you're passing the email address round in javascript, you'll need to sanitise your output to prevent possible SQL injection attacks.

igoryok-zp added a commit to igoryok-zp/Bonobo-Git-Server that referenced this issue Sep 22, 2017
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

2 participants