Add test & validation to not to register blocked IDN domains via EPP

Fixes https://github.com/internetee/registry/issues/1142#issuecomment-581889350
This commit is contained in:
Alex Sherman 2020-02-04 18:34:50 +05:00
parent 89cdfe20fc
commit 934033cfbc
2 changed files with 33 additions and 1 deletions

View file

@ -33,7 +33,9 @@ class DomainNameValidator < ActiveModel::EachValidator
def validate_blocked(value)
return true unless value
return false if BlockedDomain.where(name: value).count.positive?
return false if BlockedDomain.where(name: value).any?
return false if BlockedDomain.where(name: SimpleIDN.to_unicode(value)).any?
DNS::Zone.where(origin: value).count.zero?
end
end