Defect #32793

Email address with Punycode top-level domain is not accepted

Added by Go MAEDA 6 months ago. Updated 3 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Accounts / authentication
Target version:4.1.1
Resolution:Fixed Affected version:

Description

Redmine does not accept email addresses that have Punycode top-level domain such as "" (example.ИСПЫТАНИЕ). There are already over 150 TLDs that begin with "xn--" in the real world (see https://www.icann.org/resources/pages/tlds-2012-02-25-en), so Redmine should accept those domains.

The attached relaxes the validation rule for an email address to accept top-level domains which begin with "xn--".


Related issues

Related to Redmine - Feature #29208: IDN support for email addresses of user accounts New

Associated revisions

Revision 19660
Added by Jean-Philippe Lang 3 months ago

Email address with Punycode top-level domain is not accepted (#32793).

Patch by Go MAEDA.

Revision 19661
Added by Jean-Philippe Lang 3 months ago

Adds a test for r19660 (#32793).

Revision 19667
Added by Jean-Philippe Lang 3 months ago

Merged r19660 and r19661 to 4.1-stable (#32793).

History

#1 Updated by Go MAEDA 6 months ago

The issue can be fixed if the regular expression is changed as follows:

diff --git a/app/models/email_address.rb b/app/models/email_address.rb
index 46bca384a..dd0b30607 100644
--- a/app/models/email_address.rb
+++ b/app/models/email_address.rb
@@ -20,7 +20,7 @@
 class EmailAddress < ActiveRecord::Base
   include Redmine::SafeAttributes

-  EMAIL_REGEXP = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
+  EMAIL_REGEXP = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+(?:(?:xn--[-a-z0-9]+)|(?:[a-z]{2,})))\z/i

   belongs_to :user

#2 Updated by Go MAEDA 6 months ago

  • Related to Feature #29208: IDN support for email addresses of user accounts added

#3 Updated by Go MAEDA 6 months ago

  • Target version set to 4.1.1

Setting the target version to 4.1.1.

#4 Updated by Jean-Philippe Lang 3 months ago

  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Committed and test added, thanks.

#5 Updated by Jean-Philippe Lang 3 months ago

  • Status changed from Resolved to Closed

Merged.

Also available in: Atom PDF