Allow latin only characters #2613

This commit is contained in:
Priit Tark 2015-06-17 01:37:21 +03:00
parent 7f116527c4
commit aeb3f2c9e0
3 changed files with 25 additions and 0 deletions

View file

@ -5,6 +5,7 @@ class EppController < ApplicationController
skip_before_action :verify_authenticity_token
before_action :generate_svtrid
before_action :latin_only
before_action :validate_request
before_action :update_epp_session
helper_method :current_user
@ -106,6 +107,14 @@ class EppController < ApplicationController
write_to_epp_log
end
# VALIDATION
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
end
# VALIDATION
def validate_request
validation_method = "validate_#{params[:action]}"