From 3448a30cf0c1a22a0ae7b49815eac3be849df53b Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Sat, 15 Sep 2018 17:41:27 +0900 Subject: [PATCH 1/2] Allow Punycode in email addresses. --- app/models/email_address.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/email_address.rb b/app/models/email_address.rb index d144e2f88..52e31c744 100644 --- a/app/models/email_address.rb +++ b/app/models/email_address.rb @@ -25,7 +25,7 @@ class EmailAddress < ActiveRecord::Base after_destroy :destroy_tokens, :deliver_security_notification_destroy validates_presence_of :address - validates_format_of :address, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true + validates_format_of :address, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+(?:(?:xn--[-a-z0-9]+)|(?:[a-z]{2,})))\z/i, :allow_blank => true validates_length_of :address, :maximum => User::MAIL_LENGTH_LIMIT, :allow_nil => true validates_uniqueness_of :address, :case_sensitive => false, :if => Proc.new {|email| email.address_changed? && email.address.present?} -- 2.14.3 (Apple Git-98)