mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Update error messages for invalid attributes #2746
This commit is contained in:
parent
e1c5fca90d
commit
e9bffe930e
5 changed files with 27 additions and 9 deletions
|
@ -138,7 +138,7 @@ class EppController < ApplicationController
|
|||
# validate legal document's type here because it may be in most of the requests
|
||||
@prefix = nil
|
||||
if element_count('extdata > legalDocument') > 0
|
||||
requires_attribute('extdata > legalDocument', 'type', values: LegalDocument::TYPES)
|
||||
requires_attribute('extdata > legalDocument', 'type', values: LegalDocument::TYPES, policy: true)
|
||||
end
|
||||
|
||||
handle_errors and return if epp_errors.any?
|
||||
|
@ -188,12 +188,27 @@ class EppController < ApplicationController
|
|||
|
||||
attribute = element[attribute_selector]
|
||||
|
||||
return if attribute && options[:values].include?(attribute)
|
||||
unless attribute
|
||||
epp_errors << {
|
||||
code: '2003',
|
||||
msg: I18n.t('errors.messages.required_parameter_missing', key: attribute_selector)
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
epp_errors << {
|
||||
code: '2306',
|
||||
msg: I18n.t('attribute_is_invalid', attribute: attribute_selector)
|
||||
}
|
||||
return if options[:values].include?(attribute)
|
||||
|
||||
if options[:policy]
|
||||
epp_errors << {
|
||||
code: '2306',
|
||||
msg: I18n.t('attribute_is_invalid', attribute: attribute_selector)
|
||||
}
|
||||
else
|
||||
epp_errors << {
|
||||
code: '2004',
|
||||
msg: I18n.t('parameter_value_range_error', key: attribute_selector)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def optional_attribute(element_selector, attribute_selector, options)
|
||||
|
|
|
@ -867,3 +867,4 @@ en:
|
|||
invalid_yaml: 'Invalid YAML'
|
||||
reserved_pw: 'Reserved pw'
|
||||
no_transfers_found: 'No transfers found'
|
||||
parameter_value_range_error: 'Parameter value range error: %{key}'
|
||||
|
|
|
@ -16,6 +16,7 @@ Application build and update
|
|||
For production you probably would like to create databases to your locale, example:
|
||||
|
||||
create database registry_production owner registry encoding 'UTF-8' LC_COLLATE 'et_EE.utf8' LC_CTYPE 'et_EE.utf8' template template0;
|
||||
create extension hstore;
|
||||
|
||||
Deploy overview: (database schema should be loaded and seeds should be present)
|
||||
|
||||
|
|
|
@ -1437,8 +1437,8 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
it 'returns an error for incorrect op attribute' do
|
||||
response = epp_plain_request(domain_transfer_xml({}, 'bla'), validate_input: false)
|
||||
response[:result_code].should == '2306'
|
||||
response[:msg].should == 'Attribute is invalid: op'
|
||||
response[:msg].should == 'Parameter value range error: op'
|
||||
response[:result_code].should == '2004'
|
||||
end
|
||||
|
||||
it 'creates new pw after successful transfer' do
|
||||
|
|
|
@ -87,7 +87,8 @@ describe 'EPP Poll', epp: true do
|
|||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:msg].should == 'Attribute is invalid: op'
|
||||
response[:msg].should == 'Parameter value range error: op'
|
||||
response[:result_code].should == '2004'
|
||||
end
|
||||
|
||||
it 'dequeues multiple messages' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue