mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 10:16:01 +02:00
commit
3f7af3db03
3 changed files with 6 additions and 4 deletions
|
@ -91,7 +91,7 @@ class Domain < ActiveRecord::Base
|
||||||
after_create :update_reserved_domains
|
after_create :update_reserved_domains
|
||||||
def update_reserved_domains
|
def update_reserved_domains
|
||||||
return unless in_reserved_list?
|
return unless in_reserved_list?
|
||||||
rd = ReservedDomain.first
|
rd = ReservedDomain.by_domain(name).first
|
||||||
rd.names[name] = SecureRandom.hex
|
rd.names[name] = SecureRandom.hex
|
||||||
rd.save
|
rd.save
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,9 @@ class ReservedDomain < ActiveRecord::Base
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def pw_for(domain_name)
|
def pw_for(domain_name)
|
||||||
by_domain(domain_name).select("names -> '#{domain_name}' AS pw").first.try(:pw)
|
name_in_unicode = SimpleIDN.to_ascii(domain_name)
|
||||||
|
by_domain(domain_name).select("names -> '#{domain_name}' AS pw").first.try(:pw) ||
|
||||||
|
by_domain(name_in_unicode).select("names -> '#{name_in_unicode}' AS pw").first.try(:pw)
|
||||||
end
|
end
|
||||||
|
|
||||||
def by_domain name
|
def by_domain name
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
- @data.css('hostAttr').each do |x|
|
- @data.css('hostAttr').each do |x|
|
||||||
%tr
|
%tr
|
||||||
%td= x.css('hostName').text
|
%td= x.css('hostName').text
|
||||||
%td= x.css('hostAddr[ip="v4"]').text
|
%td= Array(x.css('hostAddr[ip="v4"]')).map(&:text).join(", ")
|
||||||
%td= x.css('hostAddr[ip="v6"]').text
|
%td= Array(x.css('hostAddr[ip="v6"]')).map(&:text).join(", ")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue