Merge branch 'master' of github.com:domify/registry

This commit is contained in:
Martin Lensment 2015-07-20 18:19:11 +03:00
commit 8ed8687691
4 changed files with 165 additions and 111 deletions

View file

@ -94,12 +94,26 @@ class Epp::ContactsController < EppController
'postalInfo > addr > pc', 'postalInfo > addr > cc', 'voice', 'email'
)
ident = params[:parsed_frame].css('ident')
if ident.present? && ident.attr('type').blank?
epp_errors << {
code: '2003',
msg: I18n.t('errors.messages.required_ident_attribute_missing', key: 'type')
}
end
if ident.present? && ident.text != 'birthday' && ident.attr('cc').blank?
epp_errors << {
code: '2003',
msg: I18n.t('errors.messages.required_attribute_missing', key: 'ident country code missing')
msg: I18n.t('errors.messages.required_ident_attribute_missing', key: 'cc')
}
end
# if ident.present? && ident.attr('cc').blank?
# epp_errors << {
# code: '2003',
# msg: I18n.t('errors.messages.required_ident_attribute_missing', key: 'cc')
# }
# end
contact_org_disabled
fax_disabled
status_editing_disabled

View file

@ -1,24 +1,25 @@
- children = HashWithIndifferentAccess.new(version.children)
- nameservers = children[:nameservers] || []
- tech_contacts = children[:tech_contacts] || []
- admin_contacts = children[:admin_contacts] || []
- registrant = children[:registrant] || []
- if version.present? && domain.present?
- children = HashWithIndifferentAccess.new(version.children)
- nameservers = children[:nameservers] || []
- tech_contacts = children[:tech_contacts] || []
- admin_contacts = children[:admin_contacts] || []
- registrant = children[:registrant] || []
%td
%td
%p.nowrap
= l(domain.updated_at, format: :short)
= version.event
%p.text-right
= version.terminator
%td
%td
%p
= "#{domain.period}#{domain.period_unit}"
= "#{l(domain.valid_from, format: :date)} - #{l(domain.valid_to, format: :date)}"
%p
= domain.status
%td
%td
- registrant.each do |oc|
%p
= oc[:name]
@ -27,7 +28,7 @@
%p
= oc[:code]
%td
%td
- admin_contacts.each do |ac|
%p
= ac[:name]
@ -36,7 +37,7 @@
%p
= ac[:code]
%td
%td
- tech_contacts.each do |tc|
%p
= tc[:name]
@ -45,7 +46,7 @@
%p
= tc[:code]
%td
%td
- nameservers.each do |ns|
%p
= ns[:hostname]
@ -53,14 +54,14 @@
= ns[:ipv4]
= ns[:ipv6]
%td
%td
%p
= domain.registrar.name
-# %td
-# %td
-# = version.children.inspect
-# %td{ class: changes.include?(:domain) ? 'edit-highlight' : 'no-highlight' }
-# %td{ class: changes.include?(:domain) ? 'edit-highlight' : 'no-highlight' }
-# - if children[:domain]
-# %p{:style => "font-size:x-small;"}
-# = children[:domain][:period]
@ -75,7 +76,7 @@
-# = ',' + children[:domain][:status]
-# %td{ class: changes.include?(:registrant) ? 'edit-highlight' : 'no-highlight' }
-# %td{ class: changes.include?(:registrant) ? 'edit-highlight' : 'no-highlight' }
-# - if children[:registrant]
-# %p{:style => "font-size:x-small;"}
-# = children[:registrant][:name]
@ -86,7 +87,7 @@
-# = ","
-# = children[:registrant][:code]
-# %td{ class: changes.include?(:admin_contacts) ? 'edit-highlight' : 'no-highlight' }
-# %td{ class: changes.include?(:admin_contacts) ? 'edit-highlight' : 'no-highlight' }
-# - if children[:admin_contacts]
-# - children[:admin_contacts].each do |ac|
-# %p{:style => "font-size:x-small;"}
@ -98,7 +99,7 @@
-# = ","
-# = ac[:code]
-# %td{ class: changes.include?(:tech_contacts) ? 'edit-highlight' : 'no-highlight' }
-# %td{ class: changes.include?(:tech_contacts) ? 'edit-highlight' : 'no-highlight' }
-# - if children[:tech_contacts]
-# - children[:tech_contacts].each do |tc|
-# %p{:style => "font-size:x-small;"}
@ -110,7 +111,7 @@
-# = ","
-# = tc[:code]
-# %td{ class: changes.include?(:nameservers) ? 'edit-highlight' : 'no-highlight' }
-# %td{ class: changes.include?(:nameservers) ? 'edit-highlight' : 'no-highlight' }
-# - if children[:nameservers]
-# - children[:nameservers].each do |ns|
-# %p{:style => "font-size:x-small;"}
@ -118,7 +119,7 @@
-# = ","
-# = ns[:ipv4] || ns[:ipv6]
-# %td
-# %td
-# %p{ :style => 'font-size:x-small;' }
-# = l(version.created_at, format: :short)
-# = whodunnit_with_protocol(version.whodunnit)

View file

@ -256,7 +256,7 @@ en:
invalid_type: 'PostalInfo type is invalid'
unimplemented_command: 'Unimplemented command'
domain_exists_but_belongs_to_other_registrar: 'Domain exists but belongs to other registrar'
required_attribute_missing: Required attributes missing
required_ident_attribute_missing: "Required ident attribute missing: %{key}"
code: 'Code'
value: 'Value'

View file

@ -170,12 +170,26 @@ describe 'EPP Contact', epp: true do
Contact.last.code.should == 'FIRST0:ABC:ABC:12345'
end
it 'should add registrar prefix for code when missing' do
response = create_request({ id: { value: 'abc:ABC:12345' } })
response[:msg].should == 'Command completed successfully'
response[:result_code].should == '1000'
Contact.last.code.should == 'FIRST0:ABC:ABC:12345'
end
it 'should not allow spaces in custom code' do
response = create_request({ id: { value: 'abc 123' } })
response[:msg].should == 'is invalid [code]'
response[:result_code].should == '2005'
end
fit 'should not allow spaces in custom code' do
response = create_request({ id: { value: '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' } })
response[:msg].should == 'is invalid [code]'
response[:result_code].should == '2005'
end
it 'should not saves ident type with wrong country code' do
extension = {
ident: {
@ -189,6 +203,31 @@ describe 'EPP Contact', epp: true do
response[:result_code].should == '2005'
end
it 'should return country missing' do
extension = {
ident: {
value: '1990-22-12',
attrs: { type: 'birthday' }
}
}
response = create_request({}, extension, validate_input: false)
response[:msg].should ==
'Required ident attribute missing: cc'
response[:result_code].should == '2003'
end
it 'should return country missing' do
extension = {
ident: {
value: '1990-22-12'
}
}
response = create_request({}, extension, validate_input: false)
response[:msg].should ==
'Required ident attribute missing: type'
response[:result_code].should == '2003'
end
it 'should add registrar prefix for code when legacy prefix present' do
response = create_request({ id: { value: 'CID:FIRST0:abc:ABC:NEW:12345' } })
response[:msg].should == 'Command completed successfully'