Refactor latin errors #2716

This commit is contained in:
Martin Lensment 2015-07-16 11:35:14 +03:00
parent 2a1e8a325d
commit 968f5d180d
2 changed files with 12 additions and 2 deletions

View file

@ -125,8 +125,13 @@ class EppController < ApplicationController
def latin_only
return true if params['frame'].blank?
return true if params['frame'].match(/\A[\p{Latin}\p{Z}\p{P}\p{S}\p{Cc}\p{Cf}\w_\'\+\-\.\(\)\/]*\Z/i)
render_epp_response '/epp/latin_error'
false
epp_errors << {
msg: 'Parameter value policy error. Allowed only Latin characters.',
code: '2306'
}
handle_errors and return false
end
# VALIDATION

View file

@ -71,6 +71,11 @@ describe 'EPP Session', epp: true do
response[:msg].should == 'Parameter value policy error. Allowed only Latin characters.'
response[:result_code].should == '2306'
response[:clTRID].should == 'ABC-12345'
log = ApiLog::EppLog.last
log.request_command.should == 'login'
log.request_successful.should == false
log.api_user_name.should == 'api-public'
end
context 'with valid user' do