Project

General

Profile

Feature #29208 » 0001-Allow-Punycode-in-email-addresses.patch

Go MAEDA, 2018-09-16 03:16

View differences:

app/models/email_address.rb
25 25
  after_destroy :destroy_tokens, :deliver_security_notification_destroy
26 26

  
27 27
  validates_presence_of :address
28
  validates_format_of :address, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true
28
  validates_format_of :address, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+(?:(?:xn--[-a-z0-9]+)|(?:[a-z]{2,})))\z/i, :allow_blank => true
29 29
  validates_length_of :address, :maximum => User::MAIL_LENGTH_LIMIT, :allow_nil => true
30 30
  validates_uniqueness_of :address, :case_sensitive => false,
31 31
    :if => Proc.new {|email| email.address_changed? && email.address.present?}
(8-8/10)