From 224053a9a1b63a8d12c9f800beaff4a85b808fff Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Mon, 20 Oct 2014 10:50:50 +0300 Subject: [PATCH 01/13] Fix ns info epp output --- app/views/epp/domains/info.xml.builder | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/views/epp/domains/info.xml.builder b/app/views/epp/domains/info.xml.builder index 0ee779080..08c150cba 100644 --- a/app/views/epp/domains/info.xml.builder +++ b/app/views/epp/domains/info.xml.builder @@ -24,14 +24,10 @@ xml.epp_head do xml.tag!('domain:ns') do @domain.nameservers.each do |x| - if x.ipv4.present? || x.ipv6.present? - xml.tag!('domain:hostAttr') do - xml.tag!('domain:hostName', x.hostname) - xml.tag!('domain:hostAddr', x.ipv4, 'ip' => 'v4') if x.ipv4.present? - xml.tag!('domain:hostAddr', x.ipv6, 'ip' => 'v6') if x.ipv6.present? - end - else - xml.tag!('domain:hostObj', x.hostname) + xml.tag!('domain:hostAttr') do + xml.tag!('domain:hostName', x.hostname) + xml.tag!('domain:hostAddr', x.ipv4, 'ip' => 'v4') if x.ipv4.present? + xml.tag!('domain:hostAddr', x.ipv6, 'ip' => 'v6') if x.ipv6.present? end end end From bf93309370e27cd8c32ef113a5fa1fd9c775b24f Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 20 Oct 2014 10:51:43 +0300 Subject: [PATCH 02/13] added lang to robot --- bin/robot | 5 ----- bin/robot-audit | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/robot b/bin/robot index 42b25a827..6f854cc06 100755 --- a/bin/robot +++ b/bin/robot @@ -3,11 +3,6 @@ # Update repo # -# default locations -export LANGUAGE=en_US.UTF-8 -export LANG=en_US.UTF-8 -export LC_ALL=en_US.UTF-8 - # cd to Rails root directory cd "$(dirname "$0")"; cd .. diff --git a/bin/robot-audit b/bin/robot-audit index ccf318ba4..60d938622 100755 --- a/bin/robot-audit +++ b/bin/robot-audit @@ -6,6 +6,11 @@ # fail later set -o pipefail +# default locations +export LANGUAGE=en_US.UTF-8 +export LANG=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 + # cp config/secrets-example.yml config/secrets.yml # create manually config/database.yml From c1f5d0ec007514afffa85b8f855adec06b3994e1 Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 20 Oct 2014 11:01:26 +0300 Subject: [PATCH 03/13] fixed spec --- spec/support/general.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/support/general.rb b/spec/support/general.rb index 3c646e2e4..99de8a409 100644 --- a/spec/support/general.rb +++ b/spec/support/general.rb @@ -14,7 +14,6 @@ module General end end - RSpec.configure do |c| c.include General end From 805cc23481bc85e1a1734e56448f83c3f5c101d6 Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 20 Oct 2014 11:08:39 +0300 Subject: [PATCH 04/13] added rails env for robot --- bin/robot-audit | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/robot-audit b/bin/robot-audit index 60d938622..e71fc57f8 100755 --- a/bin/robot-audit +++ b/bin/robot-audit @@ -10,6 +10,7 @@ set -o pipefail export LANGUAGE=en_US.UTF-8 export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 +export RAILS_ENV=test # cp config/secrets-example.yml config/secrets.yml # create manually config/database.yml From 6b71bb004cfc4596c751a57514962ae5d8633246 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Mon, 20 Oct 2014 11:13:02 +0300 Subject: [PATCH 05/13] Fix clID --- app/views/epp/domains/info.xml.builder | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/epp/domains/info.xml.builder b/app/views/epp/domains/info.xml.builder index 08c150cba..b5454e966 100644 --- a/app/views/epp/domains/info.xml.builder +++ b/app/views/epp/domains/info.xml.builder @@ -34,9 +34,9 @@ xml.epp_head do ## TODO Find out what this domain:host is all about - xml.tag!('domain:clID', @domain.owner_contact_code) + xml.tag!('domain:clID', @domain.registrar_name) - xml.tag!('domain:crID', @domain.registrar_name) if @domain.registrar #TODO Registrar has to be specified + xml.tag!('domain:crID', @domain.versions.first.reify.registrar) #TODO Registrar has to be specified xml.tag!('domain:crDate', @domain.created_at) From 4659aa0cba7df3c8e1e70576f4d46b6897f87bff Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Mon, 20 Oct 2014 11:21:00 +0300 Subject: [PATCH 06/13] Fix crID on create --- app/views/epp/domains/info.xml.builder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/epp/domains/info.xml.builder b/app/views/epp/domains/info.xml.builder index b5454e966..30970ab19 100644 --- a/app/views/epp/domains/info.xml.builder +++ b/app/views/epp/domains/info.xml.builder @@ -36,7 +36,7 @@ xml.epp_head do xml.tag!('domain:clID', @domain.registrar_name) - xml.tag!('domain:crID', @domain.versions.first.reify.registrar) #TODO Registrar has to be specified + xml.tag!('domain:crID', @domain.versions.first.reify.try(:registrar) || @domain.registrar) #TODO Registrar has to be specified xml.tag!('domain:crDate', @domain.created_at) From dd4db88ac2e9d9eea475778437ac02a957ea6e6a Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 20 Oct 2014 11:47:43 +0300 Subject: [PATCH 07/13] rename robot scripts --- bin/robot | 57 ++++++++++++++++++++++++++++++++++++++++++++----- bin/robot-audit | 57 ------------------------------------------------- bin/update-repo | 11 ++++++++++ 3 files changed, 63 insertions(+), 62 deletions(-) delete mode 100755 bin/robot-audit create mode 100755 bin/update-repo diff --git a/bin/robot b/bin/robot index 6f854cc06..695bd91e6 100755 --- a/bin/robot +++ b/bin/robot @@ -1,13 +1,60 @@ #!/bin/bash # -# Update repo +# Build and run for automatic tests # +# fail later +set -o pipefail + +# default locations +export LANGUAGE=en_US.UTF-8 +export LANG=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 +export RAILS_ENV=test + # cd to Rails root directory cd "$(dirname "$0")"; cd .. -git pull origin master &> /dev/null -git reset --hard &> /dev/null -unset GIT_DIR GIT_WORK_TREE +# cp config/secrets-example.yml config/secrets.yml +# create manually config/database.yml -bin/robot-audit +bundle install + +RAILS_ENV=test bundle exec rake db:drop +RAILS_ENV=test bundle exec rake db:create +RAILS_ENV=test bundle exec rake db:schema:load &> /dev/null +RAILS_ENV=test bundle exec rake db:seed +RAILS_ENV=test bundle exec rake assets:precompile + +echo "GIT_LAST_COMMITS" +git log origin/master -n 10 --pretty=oneline | sed -r '/^.{40} Merge branch/d' | sed -r 's/^.{40}/Latest: /' +echo "END_OF_GIT_LAST_COMMITS" + +echo "RUBOCOP_RESULTS" +bundle exec rubocop -D +RCODE=$? +echo "END_OF_RUBOCOP_RESULTS" + +echo "TEST_RESULTS" +ROBOT=true bundle exec rake test +TCODE=$? +TCODE=0 # tmp +echo "END_OF_TEST_RESULTS" + +echo "SECURITY_RESULTS" +bundle exec bundle-audit update +bundle exec bundle-audit +BCODE=$? +BCODE=0 # tmp +bundle exec brakeman +echo "END_OF_SECURITY_RESULTS" + +# update code review +bundle exec rubycritic app lib + +if [ $RCODE == 0 ] && [ $TCODE == 0 ] &&[ $BCODE == 0 ]; then + exit 0 +else + echo "ROBOTEXITWITHFAILURE" + exit 1 +fi diff --git a/bin/robot-audit b/bin/robot-audit deleted file mode 100755 index e71fc57f8..000000000 --- a/bin/robot-audit +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -# -# Build and run for automatic tests -# - -# fail later -set -o pipefail - -# default locations -export LANGUAGE=en_US.UTF-8 -export LANG=en_US.UTF-8 -export LC_ALL=en_US.UTF-8 -export RAILS_ENV=test - -# cp config/secrets-example.yml config/secrets.yml -# create manually config/database.yml - -bundle install - -RAILS_ENV=test bundle exec rake db:drop -RAILS_ENV=test bundle exec rake db:create -RAILS_ENV=test bundle exec rake db:schema:load &> /dev/null -RAILS_ENV=test bundle exec rake db:seed -RAILS_ENV=test bundle exec rake assets:precompile - -echo "GIT_LAST_COMMITS" -git log origin/master -n 10 --pretty=oneline | sed -r '/^.{40} Merge branch/d' | sed -r 's/^.{40}/Latest: /' -echo "END_OF_GIT_LAST_COMMITS" - -echo "RUBOCOP_RESULTS" -bundle exec rubocop -D -RCODE=$? -echo "END_OF_RUBOCOP_RESULTS" - -echo "TEST_RESULTS" -ROBOT=true bundle exec rake test -TCODE=$? -TCODE=0 # tmp -echo "END_OF_TEST_RESULTS" - -echo "SECURITY_RESULTS" -bundle exec bundle-audit update -bundle exec bundle-audit -BCODE=$? -BCODE=0 # tmp -bundle exec brakeman -echo "END_OF_SECURITY_RESULTS" - -# update code review -bundle exec rubycritic app lib - -if [ $RCODE == 0 ] && [ $TCODE == 0 ] &&[ $BCODE == 0 ]; then - exit 0 -else - echo "ROBOTEXITWITHFAILURE" - exit 1 -fi diff --git a/bin/update-repo b/bin/update-repo new file mode 100755 index 000000000..ae0cd536b --- /dev/null +++ b/bin/update-repo @@ -0,0 +1,11 @@ +#!/bin/bash +# +# Update repo +# + +# cd to Rails root directory +cd "$(dirname "$0")"; cd .. + +git pull origin master &> /dev/null +git reset --hard &> /dev/null +unset GIT_DIR GIT_WORK_TREE From 35d836531e7e5e5c3972353b9005a49abaeef7ac Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Mon, 20 Oct 2014 12:12:49 +0300 Subject: [PATCH 08/13] Strip and downcase domain name before processing --- app/helpers/epp/domains_helper.rb | 6 +++--- app/models/domain.rb | 1 + app/models/epp/epp_domain.rb | 2 ++ app/views/epp/domains/info.xml.builder | 2 +- spec/epp/domain_spec.rb | 17 +++++++++++------ spec/models/domain_spec.rb | 7 +++++++ 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/app/helpers/epp/domains_helper.rb b/app/helpers/epp/domains_helper.rb index 0cda5e2f7..9d1ea6332 100644 --- a/app/helpers/epp/domains_helper.rb +++ b/app/helpers/epp/domains_helper.rb @@ -167,13 +167,13 @@ module Epp::DomainsHelper ## SHARED def find_domain(secure = { secure: true }) - domain = Epp::EppDomain.find_by(name: @ph[:name]) + domain = Epp::EppDomain.find_by(name: @ph[:name].strip.downcase) unless domain epp_errors << { code: '2303', msg: I18n.t('errors.messages.epp_domain_not_found'), - value: { obj: 'name', val: @ph[:name] } + value: { obj: 'name', val: @ph[:name].strip.downcase } } return nil end @@ -182,7 +182,7 @@ module Epp::DomainsHelper epp_errors << { code: '2302', msg: I18n.t('errors.messages.domain_exists_but_belongs_to_other_registrar'), - value: { obj: 'name', val: @ph[:name] } + value: { obj: 'name', val: @ph[:name].strip.downcase } } return nil end diff --git a/app/models/domain.rb b/app/models/domain.rb index 2dd5f8655..77508bdd0 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -64,6 +64,7 @@ class Domain < ActiveRecord::Base def name=(value) value.strip! + value.downcase! self[:name] = SimpleIDN.to_unicode(value) self[:name_puny] = SimpleIDN.to_ascii(value) self[:name_dirty] = value diff --git a/app/models/epp/epp_domain.rb b/app/models/epp/epp_domain.rb index 1355b63c9..8085edcdf 100644 --- a/app/models/epp/epp_domain.rb +++ b/app/models/epp/epp_domain.rb @@ -477,6 +477,8 @@ class Epp::EppDomain < Domain res = [] domains.each do |x| + x.strip! + x.downcase! unless DomainNameValidator.validate_format(x) res << { name: x, avail: 0, reason: 'invalid format' } next diff --git a/app/views/epp/domains/info.xml.builder b/app/views/epp/domains/info.xml.builder index 30970ab19..bceea1004 100644 --- a/app/views/epp/domains/info.xml.builder +++ b/app/views/epp/domains/info.xml.builder @@ -36,7 +36,7 @@ xml.epp_head do xml.tag!('domain:clID', @domain.registrar_name) - xml.tag!('domain:crID', @domain.versions.first.reify.try(:registrar) || @domain.registrar) #TODO Registrar has to be specified + xml.tag!('domain:crID', @domain.versions.first.try(:reify).try(:registrar) || @domain.registrar) #TODO Registrar has to be specified xml.tag!('domain:crDate', @domain.created_at) diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 2888e59f0..a858ecffe 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -743,7 +743,9 @@ describe 'EPP Domain', epp: true do d.save - response = epp_request(domain_info_xml, :xml) + xml = domain_info_xml(name_value: 'Example.ee') + + response = epp_request(xml, :xml) expect(response[:results][0][:result_code]).to eq('1000') expect(response[:results][0][:msg]).to eq('Command completed successfully') @@ -758,14 +760,16 @@ describe 'EPP Domain', epp: true do expect(admin_contacts_from_request).to eq(admin_contacts_existing) - hosts_from_request = inf_data.css('hostObj').map(&:text) - hosts_existing = d.nameservers.where(ipv4: nil).pluck(:hostname) + hosts_from_request = inf_data.css('hostName').map(&:text) + hosts_existing = d.nameservers.pluck(:hostname) expect(hosts_from_request).to eq(hosts_existing) - expect(inf_data.css('hostName').first.text).to eq('ns1.example.com') - expect(inf_data.css('hostAddr').first.text).to eq('192.168.1.1') - expect(inf_data.css('hostAddr').last.text).to eq('1080:0:0:0:8:800:200C:417A') + ns1 = inf_data.css('hostAttr').last + + expect(ns1.css('hostName').last.text).to eq('ns1.example.com') + expect(ns1.css('hostAddr').first.text).to eq('192.168.1.1') + expect(ns1.css('hostAddr').last.text).to eq('1080:0:0:0:8:800:200C:417A') expect(inf_data.css('crDate').text).to eq(d.created_at.to_time.utc.to_s) expect(inf_data.css('exDate').text).to eq(d.valid_to.to_time.utc.to_s) expect(inf_data.css('pw').text).to eq(d.auth_info) @@ -865,6 +869,7 @@ describe 'EPP Domain', epp: true do expect(d.dnskeys.count).to eq(2) response = epp_request(xml, :xml) + expect(response[:results][0][:result_code]).to eq('2302') expect(response[:results][0][:msg]).to eq('Nameserver already exists on this domain') expect(response[:results][0][:value]).to eq('ns1.example.com') diff --git a/spec/models/domain_spec.rb b/spec/models/domain_spec.rb index f6d7f674a..c4dbaefe8 100644 --- a/spec/models/domain_spec.rb +++ b/spec/models/domain_spec.rb @@ -62,6 +62,13 @@ describe Domain do expect(d.errors.messages[:nameservers]).to eq(['Nameservers count must be between 2-7']) end + it 'downcases domain' do + d = Domain.new(name: 'TesT.Ee') + expect(d.name).to eq('test.ee') + expect(d.name_puny).to eq('test.ee') + expect(d.name_dirty).to eq('test.ee') + end + it 'does not create a reserved domain' do Fabricate(:reserved_domain) expect(Fabricate.build(:domain, name: '1162.ee').valid?).to be false From 081dc266322c8947bfb0762036442a8510af6fd8 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Mon, 20 Oct 2014 12:26:36 +0300 Subject: [PATCH 09/13] Normalize nameserver attributes before validation --- app/models/domain.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/models/domain.rb b/app/models/domain.rb index 77508bdd0..970ff293a 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -37,6 +37,8 @@ class Domain < ActiveRecord::Base delegate :phone, to: :owner_contact, prefix: true delegate :name, to: :registrar, prefix: true + before_validation :downcase_attributes + before_create :generate_auth_info before_create :set_validity_dates after_create :attach_default_contacts @@ -70,6 +72,14 @@ class Domain < ActiveRecord::Base self[:name_dirty] = value end + def downcase_attributes + nameservers.each do |x| + x.hostname = x.hostname.try(:strip).try(:downcase) + x.ipv4 = x.ipv4.try(:strip) + x.ipv6 = x.ipv6.try(:strip).try(:upcase) + end + end + def owner_contact_typeahead @owner_contact_typeahead || owner_contact.try(:name) || nil end From bc7c5d648b8126bdd55522dcd829635b1adcc671 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Mon, 20 Oct 2014 12:28:36 +0300 Subject: [PATCH 10/13] Test fix --- spec/epp/domain_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index a858ecffe..f31d9ba70 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -325,7 +325,7 @@ describe 'EPP Domain', epp: true do expect(response[:results][0][:value]).to eq '192.0.2.2.invalid' expect(response[:results][1][:result_code]).to eq '2005' expect(response[:results][1][:msg]).to eq 'IPv6 is invalid' - expect(response[:results][1][:value]).to eq 'invalid_ipv6' + expect(response[:results][1][:value]).to eq 'INVALID_IPV6' expect(Domain.count).to eq(0) expect(Nameserver.count).to eq(0) end From 4ea7a7ad57c166c520865fc507b573cdfdb2d8b6 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Mon, 20 Oct 2014 13:32:04 +0300 Subject: [PATCH 11/13] Refactor to nameserver --- app/models/domain.rb | 10 ---------- app/models/nameserver.rb | 8 ++++++++ spec/models/domain_spec.rb | 11 +++++++++++ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 970ff293a..77508bdd0 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -37,8 +37,6 @@ class Domain < ActiveRecord::Base delegate :phone, to: :owner_contact, prefix: true delegate :name, to: :registrar, prefix: true - before_validation :downcase_attributes - before_create :generate_auth_info before_create :set_validity_dates after_create :attach_default_contacts @@ -72,14 +70,6 @@ class Domain < ActiveRecord::Base self[:name_dirty] = value end - def downcase_attributes - nameservers.each do |x| - x.hostname = x.hostname.try(:strip).try(:downcase) - x.ipv4 = x.ipv4.try(:strip) - x.ipv6 = x.ipv6.try(:strip).try(:upcase) - end - end - def owner_contact_typeahead @owner_contact_typeahead || owner_contact.try(:name) || nil end diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index dbed6c8be..26eb94060 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -13,6 +13,8 @@ class Nameserver < ActiveRecord::Base # archiving has_paper_trail class_name: 'NameserverVersion' + before_validation :normalize_attributes + def epp_code_map { '2302' => [ @@ -29,6 +31,12 @@ class Nameserver < ActiveRecord::Base } end + def normalize_attributes + self.hostname = hostname.try(:strip).try(:downcase) + self.ipv4 = ipv4.try(:strip) + self.ipv6 = ipv6.try(:strip).try(:upcase) + end + def to_s hostname end diff --git a/spec/models/domain_spec.rb b/spec/models/domain_spec.rb index c4dbaefe8..c8de51813 100644 --- a/spec/models/domain_spec.rb +++ b/spec/models/domain_spec.rb @@ -69,6 +69,17 @@ describe Domain do expect(d.name_dirty).to eq('test.ee') end + it 'normalizes ns attrs' do + d = Fabricate(:domain) + d.nameservers.build(hostname: 'BLA.EXAMPLE.EE', ipv4: ' 192.168.1.1', ipv6: '1080:0:0:0:8:800:200c:417a') + d.save + + ns = d.nameservers.last + expect(ns.hostname).to eq('bla.example.ee') + expect(ns.ipv4).to eq('192.168.1.1') + expect(ns.ipv6).to eq('1080:0:0:0:8:800:200C:417A') + end + it 'does not create a reserved domain' do Fabricate(:reserved_domain) expect(Fabricate.build(:domain, name: '1162.ee').valid?).to be false From c89ea6998ef332afc49b9012ffca40d7b99b7071 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Mon, 20 Oct 2014 16:04:00 +0300 Subject: [PATCH 12/13] Setting fix in domain transfer --- app/controllers/client/domain_transfers_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/client/domain_transfers_controller.rb b/app/controllers/client/domain_transfers_controller.rb index 9a8de11ef..67cb2ac16 100644 --- a/app/controllers/client/domain_transfers_controller.rb +++ b/app/controllers/client/domain_transfers_controller.rb @@ -28,7 +28,7 @@ class Client::DomainTransfersController < ClientController end @domain_transfer = @domain.domain_transfers.create(domain_transfer_params) - @domain_transfer.approve_as_server if SettingGroup.domain_general.setting(:transfer_wait_time).value.to_i == 0 + @domain_transfer.approve_as_server if Setting.transfer_wait_time == 0 if @domain_transfer.approved? flash[:notice] = I18n.t('shared.domain_transfer_approved') From 946659083d1e9e991530979ce1e4d6d3aeb492c0 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Mon, 20 Oct 2014 16:39:46 +0300 Subject: [PATCH 13/13] Use auth info in domain info query --- app/helpers/epp/domains_helper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/helpers/epp/domains_helper.rb b/app/helpers/epp/domains_helper.rb index 9d1ea6332..4999e68c5 100644 --- a/app/helpers/epp/domains_helper.rb +++ b/app/helpers/epp/domains_helper.rb @@ -178,7 +178,10 @@ module Epp::DomainsHelper return nil end - if domain.registrar != current_epp_user.registrar && secure[:secure] == true + @ph[:authInfo] ||= {} + return domain if domain.auth_info == @ph[:authInfo][:pw] + + if (domain.registrar != current_epp_user.registrar && secure[:secure] == true) && epp_errors << { code: '2302', msg: I18n.t('errors.messages.domain_exists_but_belongs_to_other_registrar'),