Project

General

Profile

Refactor #14641

Simplify e-mail address regex

Added by Stephen Benjamin over 3 years ago. Updated over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
E-Mail
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

The regex in user.rb is probably one of the better ones, everything I'd expect to validate validates. However, I'd still propose it's removed, or refactored to simply be /@/.

First, some reasoning: https://davidcel.is/posts/stop-validating-email-addresses-with-regex/

Second, with RFC5322, UTF-8 is now permitted on modern servers. 甲斐@黒川.日本 is a valid e-mail address.

Also, the 60 length limit is not found in any RFC.


Related issues

Related to Foreman - Bug #9584: User email address length has maximum length of 60.Closed2015-02-27
Related to Foreman - Bug #5811: User email validation doesn't exactly match specificationClosed2014-05-20
Related to Foreman - Bug #12543: Email id with latin,utf-8 is not accepted while creating userClosed2015-11-19

History

#1 Updated by Stephen Benjamin over 3 years ago

  • Related to Bug #9584: User email address length has maximum length of 60. added

#2 Updated by Dominic Cleal over 3 years ago

  • Related to Bug #5811: User email validation doesn't exactly match specification added

#3 Updated by Amir Fefer over 3 years ago

  • Related to Bug #12543: Email id with latin,utf-8 is not accepted while creating user added

#4 Updated by Perry Gagne over 2 years ago

I agree on removing the validation or replacing it with a check for the "@" symbol.

I was doing some reading on this, and one common recommendation is to send the user a test email to validate there email address. This might not be something that applies to all cases, and is much more involved then simply checking during a UI field, but if we really wanted to make sure an email address worked, it might be worth considering.

Also available in: Atom PDF