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

@ -106,7 +106,6 @@ module Epp
updated = @domain.update(params[:parsed_frame], current_user)
(handle_errors(@domain) && return) unless updated
Dispute.close_by_domain(@domain.name) if @domain.disputed?
pending = @domain.epp_pending_update.present?
render_epp_response "/epp/domains/success#{'_pending' if pending}"
end

View file

@ -100,14 +100,14 @@ class Registrar
authorize! :update, Depp::Domain
@data = @domain.info(params[:domain_name])
@domain_params = Depp::Domain.construct_params_from_server_data(@data)
@disputed = Dispute.active.find_by(domain_name: params[:domain_name]).present?
@dispute = Dispute.active.find_by(domain_name: params[:domain_name])
end
def update
authorize! :update, Depp::Domain
@domain_params = params[:domain]
@data = @domain.update(@domain_params)
@disputed = Dispute.active.find_by(domain_name: @domain_params[:name]).present?
@dispute = Dispute.active.find_by(domain_name: @domain_params[:name])
if response_ok?
redirect_to info_registrar_domains_url(domain_name: @domain_params[:name])

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

View file

@ -31,7 +31,7 @@
.col-md-7
= check_box_tag 'domain[verified]', '1', @domain_params[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);"
- if !params[:domain_name] || @disputed
- if !params[:domain_name] || @dispute.present?
.form-group
.col-md-3.control-label
= label_tag :domain_reserved_pw, t(:reserved_pw)