Check whether registrant element exists before determining registrant change

This commit is contained in:
Karl Erik Õunapuu 2020-05-21 13:54:34 +03:00
parent 178d199020
commit f25b7a3b7f
4 changed files with 11 additions and 6 deletions

View file

@ -475,7 +475,11 @@ class Epp::Domain < Domain
self.up_date = Time.zone.now
end
same_registrant_as_current = (registrant.code == frame.css('registrant').text)
same_registrant_as_current = true
# registrant block may not be present, so we need this to rule out false positives
unless frame.css('registrant').text.blank?
same_registrant_as_current = (registrant.code == frame.css('registrant').text)
end
if !same_registrant_as_current && disputed?
disputed_pw = frame.css('reserved > pw').text
@ -484,7 +488,9 @@ class Epp::Domain < Domain
'pw element required for dispute domains')
else
dispute = Dispute.active.find_by(domain_name: name, password: disputed_pw)
if dispute.nil?
if dispute
Dispute.close_by_domain(name)
else
add_epp_error('2202', nil, nil, 'Invalid authorization information; '\
'invalid reserved>pw value')
end