mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Do not ask for confirmation if given registrant is the same as current one on EPP domain:update
#328
This commit is contained in:
parent
a5c4cd69c7
commit
a9e8d5e518
3 changed files with 215 additions and 12 deletions
|
@ -492,28 +492,20 @@ class Epp::Domain < Domain
|
||||||
at[:statuses] =
|
at[:statuses] =
|
||||||
statuses - domain_statuses_attrs(frame.css('rem'), 'rem') + domain_statuses_attrs(frame.css('add'), 'add')
|
statuses - domain_statuses_attrs(frame.css('rem'), 'rem') + domain_statuses_attrs(frame.css('add'), 'add')
|
||||||
|
|
||||||
# at[:statuses] += at_add[:domain_statuses_attributes]
|
|
||||||
|
|
||||||
if errors.empty? && verify
|
if errors.empty? && verify
|
||||||
self.upid = current_user.registrar.id if current_user.registrar
|
self.upid = current_user.registrar.id if current_user.registrar
|
||||||
self.up_date = Time.zone.now
|
self.up_date = Time.zone.now
|
||||||
end
|
end
|
||||||
|
|
||||||
if registrant_id && registrant.code == frame.css('registrant')
|
same_registrant_as_current = (registrant.code == frame.css('registrant').text)
|
||||||
|
|
||||||
throw :epp_error, {
|
if !same_registrant_as_current && errors.empty? && verify &&
|
||||||
code: '2305',
|
|
||||||
msg: I18n.t(:contact_already_associated_with_the_domain)
|
|
||||||
}
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
if errors.empty? && verify &&
|
|
||||||
Setting.request_confrimation_on_registrant_change_enabled &&
|
Setting.request_confrimation_on_registrant_change_enabled &&
|
||||||
frame.css('registrant').present? &&
|
frame.css('registrant').present? &&
|
||||||
frame.css('registrant').attr('verified').to_s.downcase != 'yes'
|
frame.css('registrant').attr('verified').to_s.downcase != 'yes'
|
||||||
registrant_verification_asked!(frame.to_s, current_user.id)
|
registrant_verification_asked!(frame.to_s, current_user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.deliver_emails = true # turn on email delivery for epp
|
self.deliver_emails = true # turn on email delivery for epp
|
||||||
|
|
||||||
errors.empty? && super(at)
|
errors.empty? && super(at)
|
||||||
|
|
|
@ -922,7 +922,6 @@ en:
|
||||||
previous: 'Previous'
|
previous: 'Previous'
|
||||||
personal_domain_verification_url: 'Personal domain verification url'
|
personal_domain_verification_url: 'Personal domain verification url'
|
||||||
available_verification_url_not_found: 'Available verification url not found, for domain.'
|
available_verification_url_not_found: 'Available verification url not found, for domain.'
|
||||||
contact_already_associated_with_the_domain: 'Object association prohibits operation, contact already associated with the domain'
|
|
||||||
add_reserved_domain: 'Add domain to reserved list'
|
add_reserved_domain: 'Add domain to reserved list'
|
||||||
add_blocked_domain: 'Add domain to blocked list'
|
add_blocked_domain: 'Add domain to blocked list'
|
||||||
edit_pw: 'Edit Pw'
|
edit_pw: 'Edit Pw'
|
||||||
|
|
|
@ -0,0 +1,212 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe 'EPP domain:update' do
|
||||||
|
let(:request) { post '/epp/command/update', frame: request_xml }
|
||||||
|
let!(:domain) { create(:domain, name: 'test.com', registrant: registrant) }
|
||||||
|
|
||||||
|
before :example do
|
||||||
|
sign_in_to_epp_area
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when registrant change confirmation is enabled' do
|
||||||
|
before :example do
|
||||||
|
Setting.request_confrimation_on_registrant_change_enabled = true
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when given registrant is the same as current one' do
|
||||||
|
let!(:registrant) { create(:registrant, code: 'TEST') }
|
||||||
|
let(:request_xml) { <<-XML
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
|
<command>
|
||||||
|
<update>
|
||||||
|
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||||
|
<domain:name>test.com</domain:name>
|
||||||
|
<domain:chg>
|
||||||
|
<domain:registrant>TEST</domain:registrant>
|
||||||
|
</domain:chg>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
<extension>
|
||||||
|
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||||
|
<eis:legalDocument type="pdf">#{valid_legal_document}</eis:legalDocument>
|
||||||
|
</eis:extdata>
|
||||||
|
</extension>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
}
|
||||||
|
|
||||||
|
specify do
|
||||||
|
request
|
||||||
|
expect(response).to have_code_of(1000)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'keeps same registrant' do
|
||||||
|
expect { request; domain.reload }.to_not change { domain.registrant_code }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not ask for confirmation' do
|
||||||
|
request
|
||||||
|
domain.reload
|
||||||
|
expect(domain.registrant_verification_asked?).to be false
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not send confirmation and notice emails' do
|
||||||
|
expect { request }.to_not change { ActionMailer::Base.deliveries.count }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when given registrant is different than current one' do
|
||||||
|
let!(:registrant) { create(:registrant, code: 'OLD-CODE') }
|
||||||
|
let!(:new_registrant) { create(:registrant, code: 'NEW-CODE') }
|
||||||
|
let(:request_xml) { <<-XML
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
|
<command>
|
||||||
|
<update>
|
||||||
|
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||||
|
<domain:name>test.com</domain:name>
|
||||||
|
<domain:chg>
|
||||||
|
<domain:registrant>NEW-CODE</domain:registrant>
|
||||||
|
</domain:chg>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
<extension>
|
||||||
|
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||||
|
<eis:legalDocument type="pdf">#{valid_legal_document}</eis:legalDocument>
|
||||||
|
</eis:extdata>
|
||||||
|
</extension>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
}
|
||||||
|
|
||||||
|
specify do
|
||||||
|
request
|
||||||
|
expect(response).to have_code_of(1001)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not change registrant without confirmation' do
|
||||||
|
expect { request; domain.reload }.to_not change { domain.registrant_code }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'asks for confirmation' do
|
||||||
|
request
|
||||||
|
domain.reload
|
||||||
|
expect(domain.registrant_verification_asked?).to be true
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sets PENDING_UPDATE status' do
|
||||||
|
request
|
||||||
|
domain.reload
|
||||||
|
expect(domain.statuses).to include(DomainStatus::PENDING_UPDATE)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sends confirmation and notice emails' do
|
||||||
|
expect { request }.to change { ActionMailer::Base.deliveries.count }.by(2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when registrant change confirmation is disabled' do
|
||||||
|
before :example do
|
||||||
|
Setting.request_confrimation_on_registrant_change_enabled = false
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when given registrant is the same as current one' do
|
||||||
|
let!(:registrant) { create(:registrant, code: 'TEST') }
|
||||||
|
let(:request_xml) { <<-XML
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
|
<command>
|
||||||
|
<update>
|
||||||
|
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||||
|
<domain:name>test.com</domain:name>
|
||||||
|
<domain:chg>
|
||||||
|
<domain:registrant>TEST</domain:registrant>
|
||||||
|
</domain:chg>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
<extension>
|
||||||
|
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||||
|
<eis:legalDocument type="pdf">#{valid_legal_document}</eis:legalDocument>
|
||||||
|
</eis:extdata>
|
||||||
|
</extension>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
}
|
||||||
|
|
||||||
|
specify do
|
||||||
|
request
|
||||||
|
expect(response).to have_code_of(1000)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'keeps same registrant' do
|
||||||
|
expect { request; domain.reload }.to_not change { domain.registrant_code }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not ask for confirmation' do
|
||||||
|
request
|
||||||
|
domain.reload
|
||||||
|
expect(domain.registrant_verification_asked?).to be false
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not send confirmation and notice emails' do
|
||||||
|
expect { request }.to_not change { ActionMailer::Base.deliveries.count }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when given registrant is different than current one' do
|
||||||
|
let!(:registrant) { create(:registrant, code: 'OLD-CODE') }
|
||||||
|
let!(:new_registrant) { create(:registrant, code: 'NEW-CODE') }
|
||||||
|
let(:request_xml) { <<-XML
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
|
<command>
|
||||||
|
<update>
|
||||||
|
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||||
|
<domain:name>test.com</domain:name>
|
||||||
|
<domain:chg>
|
||||||
|
<domain:registrant>NEW-CODE</domain:registrant>
|
||||||
|
</domain:chg>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
<extension>
|
||||||
|
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||||
|
<eis:legalDocument type="pdf">#{valid_legal_document}</eis:legalDocument>
|
||||||
|
</eis:extdata>
|
||||||
|
</extension>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
}
|
||||||
|
|
||||||
|
specify do
|
||||||
|
request
|
||||||
|
expect(response).to have_code_of(1000)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'changes registrant without confirmation' do
|
||||||
|
expect { request; domain.reload }.to change { domain.registrant_code }.from('OLD-CODE').to('NEW-CODE')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not ask for confirmation' do
|
||||||
|
request
|
||||||
|
domain.reload
|
||||||
|
expect(domain.registrant_verification_asked?).to be false
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not set PENDING_UPDATE status' do
|
||||||
|
request
|
||||||
|
domain.reload
|
||||||
|
expect(domain.statuses).to_not include(DomainStatus::PENDING_UPDATE)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not send confirmation and notice emails' do
|
||||||
|
expect { request }.to_not change { ActionMailer::Base.deliveries.count }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue