mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 03:58:27 +02:00
Rails update, request validation
This commit is contained in:
parent
4744a35dd9
commit
4684b311a2
13 changed files with 1047 additions and 70 deletions
|
@ -3,6 +3,7 @@ module Epp::Common
|
|||
|
||||
included do
|
||||
protect_from_forgery with: :null_session
|
||||
before_action :validate_request, only: [:proxy]
|
||||
end
|
||||
|
||||
def proxy
|
||||
|
@ -25,4 +26,15 @@ module Epp::Common
|
|||
def current_epp_user
|
||||
@current_epp_user ||= EppUser.find(epp_session[:epp_user_id]) if epp_session[:epp_user_id]
|
||||
end
|
||||
|
||||
def validate_request
|
||||
xsd = Nokogiri::XML::Schema(File.read('doc/schemas/epp-1.0.xsd'))
|
||||
doc = Nokogiri::XML(params[:frame])
|
||||
@extValues = xsd.validate(doc)
|
||||
if @extValues.any?
|
||||
@code = '2001'
|
||||
@msg = 'Command syntax error'
|
||||
render '/epp/error' and return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@ class Epp::ErrorsController < ApplicationController
|
|||
include Epp::Common
|
||||
|
||||
def error
|
||||
@code, @msg = params[:code], params[:msg]
|
||||
render '/epp/error'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue