Merge branch 'master' of github.com:domify/registry

Conflicts:
	config/locales/en.yml
This commit is contained in:
Martin Lensment 2015-07-15 11:31:14 +03:00
commit e722da3ed8
22 changed files with 249 additions and 34 deletions

View file

@ -56,7 +56,8 @@ class Admin::SettingsController < AdminController
:days_to_keep_overdue_invoices_active,
:days_to_renew_domain_before_expire,
:expire_warning_period,
:redemption_grace_period
:redemption_grace_period,
:expire_pending_confirmation
]
floats = [:registry_vat_prc]

View file

@ -3,7 +3,7 @@ class DomainMailer < ApplicationMailer
@domain = domain
return if Rails.env.production? ? false : !TEST_EMAILS.include?(@domain.registrant_email)
# turn on delivery on specific request only, thus rake tasks does not deliver anything
# turn on delivery on specific EPP request only, thus rake tasks does not deliver anything
return if @domain.deliver_emails != true
if @domain.registrant_verification_token.blank?
@ -25,11 +25,22 @@ class DomainMailer < ApplicationMailer
subject: "#{I18n.t(:domain_registrant_pending_updated_subject, name: @domain.name)} [#{@domain.name}]")
end
def registrant_updated(domain)
@domain = domain
return if Rails.env.production? ? false : !TEST_EMAILS.include?(@domain.registrant_email)
# turn on delivery on specific EPP request only, thus rake tasks does not deliver anything
return if @domain.deliver_emails != true
mail(to: @domain.registrant_email,
subject: "#{I18n.t(:domain_registrant_updated, name: @domain.name)} [#{@domain.name}]")
end
def pending_deleted(domain)
@domain = domain
return if Rails.env.production? ? false : !TEST_EMAILS.include?(@domain.registrant_email)
# turn on delivery on specific request only, thus rake tasks does not deliver anything
# turn on delivery on specific EPP request only, thus rake tasks does not deliver anything
return if @domain.deliver_emails != true
if @domain.registrant_verification_token.blank?

View file

@ -183,16 +183,34 @@ class Domain < ActiveRecord::Base
)
end
def clean_expired_pendings
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
expire_at = Setting.expire_pending_confirmation.hours.ago
count = 0
expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at)
expired_pending_domains.each do |domain|
unless domain.pending_update? || domain.pending_delete?
msg = "#{Time.zone.now.utc} - ISSUE: DOMAIN #{domain.id}: #{domain.name} IS IN EXPIRED PENDING LIST, " \
"but no pendingDelete/pendingUpdate state present!\n"
STDOUT << msg unless Rails.env.test?
next
end
count += 1
domain.clean_pendings!
end
STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} domain pendings\n" unless Rails.env.test?
count
end
def start_expire_period
STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test?
d = Domain.where('valid_to <= ?', Time.zone.now)
d.each do |x|
next unless x.expirable?
x.statuses << DomainStatus::EXPIRED
# TODO: This should be managed by automatic_statuses
x.statuses.delete(DomainStatus::OK)
x.save(validate: false)
domains = Domain.where('valid_to <= ?', Time.zone.now)
domains.each do |domain|
next unless domain.expirable?
domain.set_expired!
end
STDOUT << "#{Time.zone.now.utc} - Successfully expired #{d.count} domains\n" unless Rails.env.test?
@ -517,6 +535,19 @@ class Domain < ActiveRecord::Base
save(validate: false)
end
def set_expired
# TODO: currently valid_to attribute update logic is open
# self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit)
self.outzone_at = Time.zone.now + Setting.expire_warning_period.days
self.delete_at = Time.zone.now + Setting.redemption_grace_period.days
statuses << DomainStatus::EXPIRED
end
def set_expired!
set_expired
save(validate: false)
end
def manage_automatic_statuses
# domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if delete_candidateable?
if statuses.empty? && valid?

View file

@ -398,7 +398,10 @@ class Epp::Domain < Domain
frame = Nokogiri::XML(pending_json['frame'])
statuses.delete(DomainStatus::PENDING_UPDATE)
clean_pendings! if update(frame, user, false)
return unless update(frame, user, false)
clean_pendings!
self.deliver_emails = true # turn on email delivery for epp
DomainMailer.registrant_updated(self).deliver_now
end
def apply_pending_delete!
@ -429,7 +432,7 @@ class Epp::Domain < Domain
manage_automatic_statuses
true # aka 1001 pending_delete
else
destroy
set_expired!
end
end

View file

@ -21,6 +21,7 @@
= render 'setting_row', var: :dnskeys_max_count
= render 'setting_row', var: :ns_min_count
= render 'setting_row', var: :ns_max_count
= render 'setting_row', var: :expire_pending_confirmation
.panel.panel-default
.panel-heading.clearfix

View file

@ -4,7 +4,7 @@ Registrisse laekus taotlus domeeni <%= @domain.name %> kustutamiseks. Palun veen
<br><br>
Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:
<br><br>
Taotlus on aktiivne <48> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.<br>
Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.<br>
<%= link_to @verification_url, @verification_url %>
<br><br>
Lugupidamisega<br>
@ -19,7 +19,7 @@ Application for deletion of your domain <%= @domain.name %> has been filed. Plea
To confirm the update please visit this website, once again review the data and press approve:<br>
<%= link_to @verification_url, @verification_url %>
<br><br>
The application will remain in pending status for <48> hrs and will be automaticcally rejected if it is not approved nor rejected before.
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before.
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -4,7 +4,7 @@ Registrisse laekus taotlus domeeni <%= @domain.name %> kustutamiseks. Palun veen
Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:
Taotlus on aktiivne <48> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.
Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.
<%= link_to @verification_url, @verification_url %>
Lugupidamisega
@ -19,7 +19,7 @@ Application for deletion of your domain <%= @domain.name %> has been filed. Plea
To confirm the update please visit this website, once again review the data and press approve:
<%= link_to @verification_url, @verification_url %>
The application will remain in pending status for <48> hrs and will be automaticcally rejected if it is not approved nor rejected before.
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before.
Best Regards,
Estonian Internet Foundation

View file

@ -13,7 +13,9 @@ Tänav: <%= @domain.registrant_street %><br>
Linn: <%= @domain.registrant_city %><br>
Riik: <%= @domain.registrant_country %>
<br><br>
Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.<br>
Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:<br>
<%= link_to @verification_url, @verification_url %>
<br><br>
Lugupidamisega<br>
@ -36,6 +38,7 @@ Street: <%= @domain.registrant_street %><br>
City: <%= @domain.registrant_city %><br>
Country: <%= @domain.registrant_country %>
<br><br>
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before.<br>
To confirm the update please visit this website, once again review the data and press approve:<br>
<%= link_to @verification_url, @verification_url %>
<br><br>

View file

@ -13,6 +13,7 @@ Tänav: <%= @domain.registrant_street %>
Linn: <%= @domain.registrant_city %>
Riik: <%= @domain.registrant_country %>
Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.
Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:
<%= @verification_url %>
@ -36,6 +37,7 @@ Street: <%= @domain.registrant_street %>
City: <%= @domain.registrant_city %>
Country: <%= @domain.registrant_country %>
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before.
To confirm the update please visit this website, once again review the data and press approve:
<%= @verification_url %>

View file

@ -0,0 +1,39 @@
Tere,
<br><br>
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
<br><br>
Uued registreerija andmed:<br>
Nimi: <%= @domain.registrant_name %><br>
<% if @domain.registrant.priv? %>
Isikukood: <%= @domain.registrant_ident %><br>
<% else %>
Äriregistrikood: <%= @domain.registrant_ident %><br>
<% end %>
Epost: <%= @domain.registrant_email %><br>
Tänav: <%= @domain.registrant_street %><br>
Linn: <%= @domain.registrant_city %><br>
Riik: <%= @domain.registrant_country %>
<br><br>
Lugupidamisega<br>
Eesti Interneti SA
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
<br><br>
New registrant:<br>
Name: <%= @domain.registrant_name %><br>
<% if @domain.registrant.priv? %>
Personal code: <%= @domain.registrant_ident %><br>
<% else %>
Business Registry code: <%= @domain.registrant_ident %><br>
<% end %>
E-mail: <%= @domain.registrant_email %><br>
Street: <%= @domain.registrant_street %><br>
City: <%= @domain.registrant_city %><br>
Country: <%= @domain.registrant_country %>
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -0,0 +1,39 @@
Tere,
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
Uued registreerija andmed:
Nimi: <%= @domain.registrant_name %>
<% if @domain.registrant.priv? %>
Isikukood: <%= @domain.registrant_ident %>
<% else %>
Äriregistrikood: <%= @domain.registrant_ident %>
<% end %>
Epost: <%= @domain.registrant_email %>
Tänav: <%= @domain.registrant_street %>
Linn: <%= @domain.registrant_city %>
Riik: <%= @domain.registrant_country %>
Lugupidamisega
Eesti Interneti SA
--------------------------------------
Hi,
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
New registrant:
Name: <%= @domain.registrant_name %>
<% if @domain.registrant.priv? %>
Personal code: <%= @domain.registrant_ident %>
<% else %>
Business Registry code: <%= @domain.registrant_ident %>
<% end %>
E-mail: <%= @domain.registrant_email %>
Street: <%= @domain.registrant_street %>
City: <%= @domain.registrant_city %>
Country: <%= @domain.registrant_country %>
Best Regards,
Estonian Internet Foundation