Merge branch 'master' of github.com:domify/registry

This commit is contained in:
Martin Lensment 2015-06-02 13:18:34 +03:00
commit 7facd58f31
98 changed files with 1811 additions and 36 deletions

View file

@ -1,4 +1,5 @@
class EppController < ApplicationController
include Iptable
layout false
protect_from_forgery with: :null_session
skip_before_action :verify_authenticity_token
@ -285,6 +286,8 @@ class EppController < ApplicationController
# rubocop: enable Metrics/CyclomaticComplexity
def iptables_counter_update
`ENV['iptables_counter_update_command']` if ENV['iptables_counter_update_command'].present?
return if ENV['iptables_counter_enabled'].blank? && ENV['iptables_counter_enabled'] != 'true'
return if current_user.blank?
counter_update(current_user.registrar_code, request.remote_ip)
end
end

View file

@ -11,13 +11,16 @@ class ApiUser < User
}
end
# TODO: should have max request limit per day
# TODO: should have max request limit per day?
belongs_to :registrar
has_many :certificates
validates :username, :password, :registrar, :roles, presence: true
validates :username, uniqueness: true
# TODO: probably cache, because it's requested on every EPP
delegate :code, to: :registrar, prefix: true
attr_accessor :registrar_typeahead
ROLES = %w(super epp billing) # should not match to admin roles

View file

@ -185,7 +185,7 @@ class Contact < ActiveRecord::Base
if code
self.ident_country_code = code.alpha2
else
errors.add(:ident_country_code, 'is not following ISO_3166-1 alpha 2 format')
errors.add(:ident, :invalid_country_code)
end
end
end

View file

@ -229,7 +229,12 @@ module Depp
end
def extension_xml
ident_xml.merge(legal_document_xml)
xml = { _anonymus: [] }
ident = ident_xml[:_anonymus].try(:first)
legal = legal_document_xml[:_anonymus].try(:first)
xml[:_anonymus] << ident if ident.present?
xml[:_anonymus] << legal if legal.present?
xml
end
def ident_xml

View file

@ -123,7 +123,8 @@ class Epp::Contact < Contact
[:email, :invalid],
[:ident, :invalid],
[:ident, :invalid_EE_identity_format],
[:ident, :invalid_birthday_format]
[:ident, :invalid_birthday_format],
[:ident, :invalid_country_code]
],
'2302' => [ # Object exists
[:code, :epp_id_taken]

View file

@ -2,7 +2,11 @@ class LegalDocument < ActiveRecord::Base
include Versions # version/legal_document_version.rb
belongs_to :documentable, polymorphic: true
TYPES = %w(pdf bdoc ddoc zip rar gz tar 7z)
if ENV['legal_document_types'].present?
TYPES = ENV['legal_document_types'].split(',').map(&:strip)
else
TYPES = %w(pdf bdoc ddoc zip rar gz tar 7z odt doc docx)
end
attr_accessor :body