mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Cleanup #2752
This commit is contained in:
parent
c38680a3b1
commit
1d82fb9052
3 changed files with 12 additions and 5 deletions
|
@ -10,9 +10,7 @@ class EppController < ApplicationController
|
|||
before_action :validate_against_schema
|
||||
def validate_against_schema
|
||||
return if ['hello', 'error', 'keyrelay'].include?(params[:action])
|
||||
params[:schema] = 'epp-1.0.xsd' unless params[:schema]
|
||||
xsd = Nokogiri::XML::Schema(File.read("lib/schemas/#{params[:schema]}"))
|
||||
xsd.validate(params[:nokogiri_frame]).each do |error|
|
||||
schema.validate(params[:nokogiri_frame]).each do |error|
|
||||
epp_errors << {
|
||||
code: 2001,
|
||||
msg: error
|
||||
|
@ -73,6 +71,13 @@ class EppController < ApplicationController
|
|||
render_epp_response '/epp/error'
|
||||
end
|
||||
|
||||
def schema
|
||||
# TODO: Support multiple schemas
|
||||
return DOMAIN_SCHEMA if params[:epp_object_type] == :domain
|
||||
return CONTACT_SCHEMA if params[:epp_object_type] == :contact
|
||||
EPP_SCHEMA
|
||||
end
|
||||
|
||||
def generate_svtrid
|
||||
# rubocop: disable Style/VariableName
|
||||
@svTRID = "ccReg-#{format('%010d', rand(10**10))}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue