diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index 9655eddfa..fa0003756 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -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 diff --git a/app/controllers/registrar/domains_controller.rb b/app/controllers/registrar/domains_controller.rb index d0cbc3f4d..50ad0bd10 100644 --- a/app/controllers/registrar/domains_controller.rb +++ b/app/controllers/registrar/domains_controller.rb @@ -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]) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 32c7a2667..e7ab6a249 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -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 diff --git a/app/views/registrar/domains/form/_general.haml b/app/views/registrar/domains/form/_general.haml index 56858a916..5fa4d2a89 100644 --- a/app/views/registrar/domains/form/_general.haml +++ b/app/views/registrar/domains/form/_general.haml @@ -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)