Merge pull request #16 from internetee/staging

Staging
This commit is contained in:
Timo Võhmar 2015-12-01 02:29:33 +02:00
commit 3f7af3db03
3 changed files with 6 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -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(", ")