From 408d990c1ccf5033dc30a312ce7cab47a95d8de2 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Wed, 18 Dec 2019 08:55:35 +0200 Subject: [PATCH 1/4] Reformat --- app/views/epp/contacts/info.xml.builder | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/epp/contacts/info.xml.builder b/app/views/epp/contacts/info.xml.builder index 38a96a706..4d44b0d61 100644 --- a/app/views/epp/contacts/info.xml.builder +++ b/app/views/epp/contacts/info.xml.builder @@ -68,11 +68,11 @@ xml.epp_head do # xml.tag!('contact:trDate', '123') if false if can? :view_password, @contact, @password 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') + xml.tag!('contact:pw', 'No access') end end end From b90a937c9adb32c178c4af36d4ec30acac043ce4 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Wed, 18 Dec 2019 08:55:48 +0200 Subject: [PATCH 2/4] Remove comment --- app/views/epp/contacts/info.xml.builder | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/epp/contacts/info.xml.builder b/app/views/epp/contacts/info.xml.builder index 4d44b0d61..07ba1102f 100644 --- a/app/views/epp/contacts/info.xml.builder +++ b/app/views/epp/contacts/info.xml.builder @@ -65,7 +65,6 @@ xml.epp_head do xml.tag!('contact:upID', upID) if upID.present? # optional upID xml.tag!('contact:upDate', @contact.updated_at.try(:iso8601)) end - # xml.tag!('contact:trDate', '123') if false if can? :view_password, @contact, @password xml.tag!('contact:authInfo') do xml.tag!('contact:pw', @contact.auth_info) From 5d2f1a89fb004d7630eab0cedb4507a6e74267c8 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Wed, 18 Dec 2019 09:14:13 +0200 Subject: [PATCH 3/4] Hide contact password unless the current registrar is sponsoring Closes #1446 --- app/views/epp/contacts/info.xml.builder | 4 --- .../integration/epp/contact/info/base_test.rb | 30 ++++++++++++++++++- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/app/views/epp/contacts/info.xml.builder b/app/views/epp/contacts/info.xml.builder index 07ba1102f..1945e7def 100644 --- a/app/views/epp/contacts/info.xml.builder +++ b/app/views/epp/contacts/info.xml.builder @@ -69,10 +69,6 @@ xml.epp_head do xml.tag!('contact:authInfo') do xml.tag!('contact:pw', @contact.auth_info) end - else - xml.tag!('contact:authInfo') do - xml.tag!('contact:pw', 'No access') - end end end end diff --git a/test/integration/epp/contact/info/base_test.rb b/test/integration/epp/contact/info/base_test.rb index 23a839801..80dad97e8 100644 --- a/test/integration/epp/contact/info/base_test.rb +++ b/test/integration/epp/contact/info/base_test.rb @@ -44,9 +44,37 @@ class EppContactInfoBaseTest < EppTestCase contact: xml_schema).text 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 + + + + + + #{@contact.code} + + + + + 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 def xml_schema 'https://epp.tld.ee/schema/contact-ee-1.1.xsd' end -end \ No newline at end of file +end From 75eb9faed7737794412b28bab23166b62fb45104 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Wed, 18 Dec 2019 09:21:52 +0200 Subject: [PATCH 4/4] Remove unused translation --- config/locales/en.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index a12385169..75f9a6542 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -195,7 +195,6 @@ en: domain_details: 'Domain details' registered_at: 'Registered at' password: 'Password' - authinfo_pw: 'AuthInfo pw' valid_from: 'Valid from' general: 'General' contacts: 'Contacts'