Email Validation RegEx fails for TLD >9 chars

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
1/25/2018 9:06:43 AM
Gravatar
Total Posts 4

Email Validation RegEx fails for TLD >9 chars

Running MojoPortal 2600 / MSSql (more details available, but not necessary to reproduce the problem).

Trying to add a new user with the email address xxx@yyy.zzz fails, if "zzz" has more than 9 characters.

The current TLD is ".university" which has 10 characters. The system will accept any (non existant) domain if I drop any character from the word so it fits the 9-character-boundary.

From what I understood, this is due to a client-side RegEx (EmailValidator), but how can I fix this?

1/25/2018 9:27:51 AM
Gravatar
Total Posts 2239

Re: Email Validation RegEx fails for TLD >9 chars

Hi,

You can add the following to your user.config file. After changing the user.config, you will have to "touch" the web.config to get IIS to reload both files.

By default, the 10 at the end of the value string is a 9. Increasing it to 10 should allow for TLDs of up to 10 characters. I caution you on increasing it more than you really need to because it can lead to performance issues.

<add key="CustomEmailRegex" value="^([0-9a-zA-Z](['-.\w]*[_0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w']*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,10})$" />

Thank you,
Joe

1/25/2018 10:00:04 AM
Gravatar
Total Posts 4

Re: Email Validation RegEx fails for TLD >9 chars

Hi!

I can confirm this did the trick - thank you very much for the quick response!

 

Dan

You must sign in to post in the forums. This thread is closed to new posts.