mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Fix some epp tests
This commit is contained in:
parent
a740ed34f3
commit
f63eb66f02
6 changed files with 83 additions and 39 deletions
|
@ -54,6 +54,7 @@ class Domain < ActiveRecord::Base
|
|||
validate :validate_tech_contacts_uniqueness
|
||||
validate :validate_admin_contacts_uniqueness
|
||||
validate :validate_domain_statuses_uniqueness
|
||||
# validate :validate_dnskeys_uniqueness
|
||||
validate :validate_nameserver_ips
|
||||
|
||||
attr_accessor :owner_contact_typeahead
|
||||
|
@ -158,6 +159,19 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def validate_dnskeys_uniqueness
|
||||
validated = []
|
||||
list = dnskeys.reject(&:marked_for_destruction?)
|
||||
list.each do |dnskey|
|
||||
next if dnskey.public_key.blank?
|
||||
existing = list.select { |x| x.public_key == dnskey.public_key }
|
||||
next unless existing.length > 1
|
||||
validated << dnskey.public_key
|
||||
errors.add(:dnskeys, :invalid) if errors[:dnskeys].blank?
|
||||
dnskey.errors.add(:public_key, :taken)
|
||||
end
|
||||
end
|
||||
|
||||
def validate_period
|
||||
return unless period.present?
|
||||
if period_unit == 'd'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue