mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Merge pull request #1447 from internetee/fix-epp-response
Hide contact password unless the current registrar is sponsoring
This commit is contained in:
commit
844e613ee1
3 changed files with 30 additions and 8 deletions
|
@ -65,14 +65,9 @@ xml.epp_head do
|
||||||
xml.tag!('contact:upID', upID) if upID.present? # optional upID
|
xml.tag!('contact:upID', upID) if upID.present? # optional upID
|
||||||
xml.tag!('contact:upDate', @contact.updated_at.try(:iso8601))
|
xml.tag!('contact:upDate', @contact.updated_at.try(:iso8601))
|
||||||
end
|
end
|
||||||
# xml.tag!('contact:trDate', '123') if false
|
|
||||||
if can? :view_password, @contact, @password
|
if can? :view_password, @contact, @password
|
||||||
xml.tag!('contact:authInfo') do
|
xml.tag!('contact:authInfo') do
|
||||||
xml.tag!('contact:pw', @contact.auth_info)
|
xml.tag!('contact:pw', @contact.auth_info)
|
||||||
end
|
|
||||||
else
|
|
||||||
xml.tag!('contact:authInfo') do
|
|
||||||
xml.tag!('contact:pw', 'No access')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -195,7 +195,6 @@ en:
|
||||||
domain_details: 'Domain details'
|
domain_details: 'Domain details'
|
||||||
registered_at: 'Registered at'
|
registered_at: 'Registered at'
|
||||||
password: 'Password'
|
password: 'Password'
|
||||||
authinfo_pw: 'AuthInfo pw'
|
|
||||||
valid_from: 'Valid from'
|
valid_from: 'Valid from'
|
||||||
general: 'General'
|
general: 'General'
|
||||||
contacts: 'Contacts'
|
contacts: 'Contacts'
|
||||||
|
|
|
@ -44,9 +44,37 @@ class EppContactInfoBaseTest < EppTestCase
|
||||||
contact: xml_schema).text
|
contact: xml_schema).text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_hides_password_when_current_registrar_is_not_sponsoring
|
||||||
|
non_sponsoring_registrar = registrars(:goodnames)
|
||||||
|
@contact.update!(registrar: non_sponsoring_registrar)
|
||||||
|
|
||||||
|
# https://github.com/internetee/registry/issues/415
|
||||||
|
@contact.update_columns(code: @contact.code.upcase)
|
||||||
|
|
||||||
|
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>
|
||||||
|
<info>
|
||||||
|
<contact:info xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
|
||||||
|
<contact:id>#{@contact.code}</contact:id>
|
||||||
|
</contact:info>
|
||||||
|
</info>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
|
||||||
|
post epp_info_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' =>
|
||||||
|
'session=api_bestnames' }
|
||||||
|
|
||||||
|
assert_epp_response :completed_successfully
|
||||||
|
response_xml = Nokogiri::XML(response.body)
|
||||||
|
assert_nil response_xml.at_xpath('//contact:authInfo', contact: xml_schema)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def xml_schema
|
def xml_schema
|
||||||
'https://epp.tld.ee/schema/contact-ee-1.1.xsd'
|
'https://epp.tld.ee/schema/contact-ee-1.1.xsd'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue