mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
parent
00041df311
commit
80327d3447
4 changed files with 17 additions and 2 deletions
|
@ -5,7 +5,7 @@ class Nameserver < ActiveRecord::Base
|
|||
belongs_to :domain, required: true
|
||||
|
||||
# rubocop: disable Metrics/LineLength
|
||||
validates :hostname, format: { with: /\A(([a-zA-Z0-9]|[a-zA-ZäöüõšžÄÖÜÕŠŽ0-9][a-zA-ZäöüõšžÄÖÜÕŠŽ0-9\-]*[a-zA-ZäöüõšžÄÖÜÕŠŽ0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ }
|
||||
validates :hostname, presence: true, format: { with: /\A(([a-zA-Z0-9]|[a-zA-ZäöüõšžÄÖÜÕŠŽ0-9][a-zA-ZäöüõšžÄÖÜÕŠŽ0-9\-]*[a-zA-ZäöüõšžÄÖÜÕŠŽ0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ }
|
||||
validate :val_ipv4
|
||||
validate :val_ipv6
|
||||
# rubocop: enable Metrics/LineLength
|
||||
|
@ -40,6 +40,8 @@ class Nameserver < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def check_label_length
|
||||
return unless hostname
|
||||
|
||||
hostname_puny.split('.').each do |label|
|
||||
errors.add(:hostname, :puny_to_long) if label.length > 63
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue