mirror of
https://github.com/internetee/registry.git
synced 2025-07-19 17:25:57 +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
|
||||
def update_reserved_domains
|
||||
return unless in_reserved_list?
|
||||
rd = ReservedDomain.first
|
||||
rd = ReservedDomain.by_domain(name).first
|
||||
rd.names[name] = SecureRandom.hex
|
||||
rd.save
|
||||
end
|
||||
|
|
|
@ -9,7 +9,9 @@ class ReservedDomain < ActiveRecord::Base
|
|||
|
||||
class << self
|
||||
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
|
||||
|
||||
def by_domain name
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
- @data.css('hostAttr').each do |x|
|
||||
%tr
|
||||
%td= x.css('hostName').text
|
||||
%td= x.css('hostAddr[ip="v4"]').text
|
||||
%td= x.css('hostAddr[ip="v6"]').text
|
||||
%td= Array(x.css('hostAddr[ip="v4"]')).map(&:text).join(", ")
|
||||
%td= Array(x.css('hostAddr[ip="v6"]')).map(&:text).join(", ")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue