mirror of
https://github.com/internetee/registry.git
synced 2025-07-26 04:28:27 +02:00
Merge pull request #1929 from internetee/1927-disputes-closing-fix
Validating info epp response on disputed domain against schema
This commit is contained in:
commit
aa97b4954b
10 changed files with 120 additions and 41 deletions
|
@ -38,7 +38,7 @@ module Admin
|
|||
|
||||
# PATCH/PUT /admin/disputes/1
|
||||
def update
|
||||
if @dispute.update(dispute_params.except(:domain_name))
|
||||
if @dispute.update(dispute_params.except(:domain_name, :starts_at))
|
||||
redirect_to admin_disputes_url, notice: 'Dispute was successfully updated.'
|
||||
else
|
||||
render :edit
|
||||
|
@ -68,7 +68,9 @@ module Admin
|
|||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def dispute_params
|
||||
params.require(:dispute).permit(:domain_name, :password, :starts_at, :comment)
|
||||
params.require(:dispute)
|
||||
.permit(:domain_name, :password, :starts_at, :comment)
|
||||
.with_defaults(starts_at: Time.zone.today)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -209,9 +209,9 @@ module Actions
|
|||
end
|
||||
|
||||
def verify_registrant_change?
|
||||
return if !@changes_registrant || params[:registrant][:verified] == true
|
||||
return true unless domain.disputed?
|
||||
return validate_dispute_case if params[:reserved_pw]
|
||||
return false if !@changes_registrant || params[:registrant][:verified] == true
|
||||
return true unless domain.disputed?
|
||||
|
||||
domain.add_epp_error('2304', nil, nil, 'Required parameter missing; reservedpw element ' \
|
||||
'required for dispute domains')
|
||||
|
|
|
@ -43,10 +43,10 @@ class Dispute < ApplicationRecord
|
|||
end
|
||||
|
||||
def generate_data
|
||||
return if starts_at > Time.zone.today || expires_at < Time.zone.today
|
||||
return false if starts_at > Time.zone.today || expires_at < Time.zone.today
|
||||
|
||||
domain&.mark_as_disputed
|
||||
return if domain
|
||||
return true if domain
|
||||
|
||||
wr = Whois::Record.find_or_initialize_by(name: domain_name)
|
||||
wr.json = @json = generate_json(wr, domain_status: 'disputed')
|
||||
|
|
|
@ -33,6 +33,8 @@ class Domain < ApplicationRecord
|
|||
has_many :tech_domain_contacts
|
||||
accepts_nested_attributes_for :tech_domain_contacts, allow_destroy: true, reject_if: :tech_change_prohibited?
|
||||
|
||||
ID_CHAR_LIMIT = 8
|
||||
|
||||
def registrant_change_prohibited?
|
||||
statuses.include? DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED
|
||||
end
|
||||
|
@ -331,7 +333,12 @@ class Domain < ApplicationRecord
|
|||
end
|
||||
|
||||
def roid
|
||||
"EIS-#{id}"
|
||||
id_size = id.to_s.size
|
||||
if id_size <= ID_CHAR_LIMIT
|
||||
"EIS-#{id}"
|
||||
else
|
||||
roid_with_prefix(id_size)
|
||||
end
|
||||
end
|
||||
|
||||
def puny_label
|
||||
|
@ -734,4 +741,13 @@ class Domain < ApplicationRecord
|
|||
def self.uses_zone?(zone)
|
||||
exists?(["name ILIKE ?", "%.#{zone.origin}"])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def roid_with_prefix(id_size)
|
||||
id_delta = id_size - ID_CHAR_LIMIT
|
||||
id_prefix = id.to_s.split(//).first(id_delta).join('').to_s
|
||||
id_postfix = id.to_s.split(//).last(id_size - id_delta).join('').to_s
|
||||
"EIS#{id_prefix}-#{id_postfix}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</div>
|
||||
<div class="panel-body">
|
||||
<div>
|
||||
<p>As per domain law, expiry time is <%= Setting.dispute_period_in_months / 12 %> years ahead from start date.</p>
|
||||
<p>As per domain law, expiry time is <%= Setting.dispute_period_in_months / 12 %> years ahead from creation date (today).</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-4 control-label">
|
||||
|
@ -30,15 +30,6 @@
|
|||
<span class="help-block"><%= t '.password_hint' %></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-4 control-label">
|
||||
<%= f.label :starts_at %>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<%= f.text_field(:starts_at, class: 'form-control js-datepicker') %>
|
||||
<span class="help-block"><%= t '.past_or_today' %></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-4 control-label">
|
||||
<%= f.label :comment %>
|
||||
|
@ -47,6 +38,14 @@
|
|||
<%= f.text_field(:comment, placeholder: t(:optional), class: 'form-control') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-4 control-label">
|
||||
<%= f.label :starts_at %>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<span class="help-block"><%= t '.today' %></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue