From 968f5d180dfebbea6984d76bb93add2297271476 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Thu, 16 Jul 2015 11:35:14 +0300 Subject: [PATCH] Refactor latin errors #2716 --- app/controllers/epp_controller.rb | 9 +++++++-- spec/epp/session_spec.rb | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb index 2cd1c8bc7..29261fdff 100644 --- a/app/controllers/epp_controller.rb +++ b/app/controllers/epp_controller.rb @@ -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 diff --git a/spec/epp/session_spec.rb b/spec/epp/session_spec.rb index d3642a1fd..d5438ad7a 100644 --- a/spec/epp/session_spec.rb +++ b/spec/epp/session_spec.rb @@ -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