mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Minor fixes
This commit is contained in:
parent
2eb0e9ea76
commit
ad2236a5f4
2 changed files with 15 additions and 13 deletions
|
@ -17,7 +17,7 @@ module Epp::DomainsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def renew_domain
|
def renew_domain
|
||||||
# TODO support period unit
|
# TODO: support period unit
|
||||||
@domain = find_domain
|
@domain = find_domain
|
||||||
|
|
||||||
handle_errors(@domain) and return unless @domain
|
handle_errors(@domain) and return unless @domain
|
||||||
|
|
|
@ -94,7 +94,8 @@ class Domain < ActiveRecord::Base
|
||||||
def attach_contacts(contacts)
|
def attach_contacts(contacts)
|
||||||
contacts.each do |k, v|
|
contacts.each do |k, v|
|
||||||
v.each do |x|
|
v.each do |x|
|
||||||
if contact = Contact.find_by(code: x[:contact])
|
contact = Contact.find_by(code: x[:contact])
|
||||||
|
if contact
|
||||||
attach_contact(k, contact)
|
attach_contact(k, contact)
|
||||||
else
|
else
|
||||||
# Detailed error message with value to display in EPP response
|
# Detailed error message with value to display in EPP response
|
||||||
|
@ -107,13 +108,10 @@ class Domain < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if owner_contact
|
return unless owner_contact
|
||||||
attach_contact(DomainContact::TECH, owner_contact) if tech_contacts.empty?
|
|
||||||
|
|
||||||
if owner_contact.citizen?
|
attach_contact(DomainContact::TECH, owner_contact) if tech_contacts.empty?
|
||||||
attach_contact(DomainContact::ADMIN, owner_contact) if admin_contacts.empty?
|
attach_contact(DomainContact::ADMIN, owner_contact) if admin_contacts.empty? if owner_contact.citizen?
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def attach_contact(type, contact)
|
def attach_contact(type, contact)
|
||||||
|
@ -196,7 +194,7 @@ class Domain < ActiveRecord::Base
|
||||||
### RENEW ###
|
### RENEW ###
|
||||||
|
|
||||||
def renew(cur_exp_date, period, unit = 'y')
|
def renew(cur_exp_date, period, unit = 'y')
|
||||||
# TODO Check how much time before domain exp date can it be renewed
|
# TODO: Check how much time before domain exp date can it be renewed
|
||||||
validate_exp_dates(cur_exp_date)
|
validate_exp_dates(cur_exp_date)
|
||||||
return false if errors.any?
|
return false if errors.any?
|
||||||
|
|
||||||
|
@ -214,10 +212,9 @@ class Domain < ActiveRecord::Base
|
||||||
sg = SettingGroup.domain_validation
|
sg = SettingGroup.domain_validation
|
||||||
min, max = sg.setting(:ns_min_count).value.to_i, sg.setting(:ns_max_count).value.to_i
|
min, max = sg.setting(:ns_min_count).value.to_i, sg.setting(:ns_max_count).value.to_i
|
||||||
|
|
||||||
unless nameservers.length.between?(min, max)
|
return if nameservers.length.between?(min, max)
|
||||||
errors.add(:nameservers, :out_of_range, { min: min, max: max })
|
errors.add(:nameservers, :out_of_range, { min: min, max: max })
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def validate_admin_contacts_count
|
def validate_admin_contacts_count
|
||||||
errors.add(:admin_contacts, :blank) if admin_contacts.empty?
|
errors.add(:admin_contacts, :blank) if admin_contacts.empty?
|
||||||
|
@ -258,7 +255,12 @@ class Domain < ActiveRecord::Base
|
||||||
[:valid_to, :epp_exp_dates_do_not_match]
|
[:valid_to, :epp_exp_dates_do_not_match]
|
||||||
],
|
],
|
||||||
'2004' => [ # Parameter value range error
|
'2004' => [ # Parameter value range error
|
||||||
[:nameservers, :out_of_range, { min: domain_validation_sg.setting(:ns_min_count).value, max: domain_validation_sg.setting(:ns_max_count).value }],
|
[:nameservers, :out_of_range,
|
||||||
|
{
|
||||||
|
min: domain_validation_sg.setting(:ns_min_count).value,
|
||||||
|
max: domain_validation_sg.setting(:ns_max_count).value
|
||||||
|
}
|
||||||
|
],
|
||||||
[:period, :out_of_range]
|
[:period, :out_of_range]
|
||||||
],
|
],
|
||||||
'2303' => [ # Object does not exist
|
'2303' => [ # Object does not exist
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue