Invitation email regex is not large enough


#1

Situation

When inviting a user with email *@example.org (wildcard at domain dot tld), the completion field validates to @example.org (at domain dot tld). This bug also works with ~@example.org.

Expectation

  • Although rare, the wildcard character * and the tilde character ~ are both valid usernames in email. Therefore they should be acceptable.
  • The validation should return the exact same string as entered or fail.

Solution

  • Fix the regular expression to accept * or ~ as an email username. This does not mean ‘any user at domain’: it really means the user with email * at domain dot tld.
  • Ensure the field completion returns the same value as it was provided in case it validates.

(Stephen Chung) #2

I learn something new every day! Turns out that a whole bunch of special characters are valid as email addresses:

https://tools.ietf.org/html/rfc5322#section-3.2.3


(Felix Freiberger) #3

Email addresses are very weird! All of these are valid email addresses:

  • "Test User"@example.org
  • "@"@example.org
  • felix(test)@example.org

Even worse: felix(test)@example.org is identical to felix@example.org, because (test) is a comment. And as comments can be nested, regular expressions cannot validate email addresses correctly!


(Stephen Chung) #4

Well, IMHO, people get what they deserve when they pick wacko email addresses!

:sunglasses:

EDIT: IMHO people should use ASCII letters/digits/dashes/dots only for email addresses. That should be most compatible with the world’s software.


#5

I’m sorry but this kind of comments makes me cringe. Normality can never be the excuse for not doing something. Maybe people have good reason why they do things like they do, and your normalcy should never become an argument against their vision, especially when, by any agreed upon standard, their use is valid. You have a very straightforward line of thought from this argument to letting things rot because, you know, it’s normal.


(Stephen Chung) #6

@hellekin I stand corrected. :bow: