diff options
author | Go MAEDA <maeda@farend.jp> | 2025-04-19 06:38:17 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2025-04-19 06:38:17 +0000 |
commit | 7d9cdc16babae38dedc43c9469537b5283a7aa0a (patch) | |
tree | ce5ecc6c3d19bc00f01034b9f4314764183b9d99 /app/models | |
parent | 4e0c05bfd4ee90970a084100e37768cf8baef90e (diff) | |
download | redmine-5.1-stable.tar.gz redmine-5.1-stable.zip |
Merged r23666 from trunk to 5.1-stable (#42584).5.1-stable
git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@23682 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/email_address.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/email_address.rb b/app/models/email_address.rb index 1e7a25ee7..909221f1a 100644 --- a/app/models/email_address.rb +++ b/app/models/email_address.rb @@ -66,7 +66,7 @@ class EmailAddress < ActiveRecord::Base # Returns true if domain belongs to domains list. def self.domain_in?(domain, domains) - domain = domain.downcase + domain = domain.to_s.downcase domains = domains.to_s.split(/[\s,]+/) unless domains.is_a?(Array) domains.reject(&:blank?).map(&:downcase).any? do |s| s.start_with?('.') ? domain.end_with?(s) : domain == s @@ -142,6 +142,10 @@ class EmailAddress < ActiveRecord::Base def validate_email_domain domain = address.partition('@').last + # Skip domain validation if the email does not contain a domain part, + # to avoid an incomplete error message like "domain not allowed ()" + return if domain.empty? + return if self.class.valid_domain?(domain) if User.current.logged? |