mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 01:36:02 +02:00
Add different ip version support to nameserver
This commit is contained in:
parent
a846a51444
commit
793b0d22ff
7 changed files with 18 additions and 13 deletions
|
@ -113,10 +113,10 @@ class Domain < ActiveRecord::Base
|
|||
if ns[:hostAddr]
|
||||
if ns[:hostAddr].is_a?(Array)
|
||||
ns[:hostAddr].each do |ip|
|
||||
attrs[:ip] = ip unless attrs[:ip]
|
||||
attrs[:ipv4] = ip unless attrs[:ipv4]
|
||||
end
|
||||
else
|
||||
attrs[:ip] = ns[:hostAddr]
|
||||
attrs[:ipv4] = ns[:hostAddr]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ class Nameserver < ActiveRecord::Base
|
|||
include EppErrors
|
||||
|
||||
EPP_CODE_MAP = {
|
||||
'2005' => ['Hostname is invalid', 'IP is invalid']
|
||||
'2005' => ['Hostname is invalid', 'IPv4 is invalid']
|
||||
}
|
||||
|
||||
EPP_ATTR_MAP = {
|
||||
|
@ -13,5 +13,5 @@ class Nameserver < ActiveRecord::Base
|
|||
has_and_belongs_to_many :domains
|
||||
|
||||
validates :hostname, format: { with: /\A(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ }
|
||||
validates :ip, format: { with: /\A(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\z/, allow_nil: true }
|
||||
validates :ipv4, format: { with: /\A(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\z/, allow_nil: true }
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue