Merge branch 'master' into alpha

This commit is contained in:
Priit Tark 2015-09-10 10:42:14 +03:00
commit 21e1a1a3d4
23 changed files with 2021 additions and 2023 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@ config/initializers/secret_token.rb
config/deploy.rb
config/secrets.yml
config/database.yml
misc
/export
/import
/ca

View file

@ -24,3 +24,12 @@ services:
- postgresql
addons:
postgresql: "9.3"
notifications:
email:
- priit@gitlab.eu
- martin@gitlab.eu
branches:
only:
- master
- alpha
- staging

View file

@ -8,7 +8,7 @@ end if Bundler::VERSION < '2'
source 'https://rubygems.org'
# core
gem 'rails', '4.2.3' # when update, all initializers eis_custom files needs check/update
gem 'rails', '4.2.4' # when update, all initializers eis_custom files needs check/update
gem 'iso8601', '0.8.6' # for dates and times
gem 'hashie-forbidden_attributes', '0.1.1'
gem 'SyslogLogger', '2.0', require: 'syslog/logger'

View file

@ -38,38 +38,38 @@ GEM
specs:
SyslogLogger (2.0)
abstract_type (0.0.7)
actionmailer (4.2.3)
actionpack (= 4.2.3)
actionview (= 4.2.3)
activejob (= 4.2.3)
actionmailer (4.2.4)
actionpack (= 4.2.4)
actionview (= 4.2.4)
activejob (= 4.2.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.3)
actionview (= 4.2.3)
activesupport (= 4.2.3)
actionpack (4.2.4)
actionview (= 4.2.4)
activesupport (= 4.2.4)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.3)
activesupport (= 4.2.3)
actionview (4.2.4)
activesupport (= 4.2.4)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.3)
activesupport (= 4.2.3)
activejob (4.2.4)
activesupport (= 4.2.4)
globalid (>= 0.3.0)
activemodel (4.2.3)
activesupport (= 4.2.3)
activemodel (4.2.4)
activesupport (= 4.2.4)
builder (~> 3.1)
activerecord (4.2.3)
activemodel (= 4.2.3)
activesupport (= 4.2.3)
activerecord (4.2.4)
activemodel (= 4.2.4)
activesupport (= 4.2.4)
arel (~> 6.0)
activerecord-import (0.7.0)
activerecord (>= 3.0)
activesupport (4.2.3)
activesupport (4.2.4)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
@ -90,7 +90,7 @@ GEM
actionpack
activesupport (>= 3.0.0)
rspec
autoprefixer-rails (5.2.1.1)
autoprefixer-rails (6.0.2)
execjs
json
axiom-types (0.1.1)
@ -181,7 +181,7 @@ GEM
builder (~> 3.2)
equalizer (0.0.11)
erubis (2.7.0)
execjs (2.5.2)
execjs (2.6.0)
fabrication (2.13.2)
faker (1.4.3)
i18n (~> 0.5)
@ -230,7 +230,7 @@ GEM
rubocop (~> 0.20)
gyoku (1.3.1)
builder (>= 2.1.2)
haml (4.0.6)
haml (4.0.7)
tilt
haml-rails (0.9.0)
actionpack (>= 4.0.1)
@ -273,7 +273,7 @@ GEM
kaminari (0.16.3)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.9.3)
kgio (2.10.0)
launchy (2.4.3)
addressable (~> 2.3)
libv8 (3.16.14.11)
@ -282,7 +282,7 @@ GEM
listen (3.0.3)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
loofah (2.0.2)
loofah (2.0.3)
nokogiri (>= 1.5.9)
lumberjack (1.0.9)
mail (2.6.3)
@ -353,20 +353,20 @@ GEM
rack-test (0.6.3)
rack (>= 1.0)
railroady (1.3.0)
rails (4.2.3)
actionmailer (= 4.2.3)
actionpack (= 4.2.3)
actionview (= 4.2.3)
activejob (= 4.2.3)
activemodel (= 4.2.3)
activerecord (= 4.2.3)
activesupport (= 4.2.3)
rails (4.2.4)
actionmailer (= 4.2.4)
actionpack (= 4.2.4)
actionview (= 4.2.4)
activejob (= 4.2.4)
activemodel (= 4.2.4)
activerecord (= 4.2.4)
activesupport (= 4.2.4)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.3)
railties (= 4.2.4)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.6)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
@ -374,9 +374,9 @@ GEM
loofah (~> 2.0)
rails-settings-cached (0.4.1)
rails (>= 4.0.0)
railties (4.2.3)
actionpack (= 4.2.3)
activesupport (= 4.2.3)
railties (4.2.4)
actionpack (= 4.2.4)
activesupport (= 4.2.4)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.0.0)
@ -388,7 +388,7 @@ GEM
activesupport (>= 3.0)
i18n
polyamorous (~> 1.1)
rb-fsevent (0.9.5)
rb-fsevent (0.9.6)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdoc (4.2.0)
@ -440,7 +440,7 @@ GEM
reek (= 1.6.5)
virtus (~> 1.0)
safe_yaml (1.0.4)
sass (3.4.16)
sass (3.4.18)
sass-rails (5.0.3)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
@ -479,9 +479,9 @@ GEM
spring (1.3.6)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (3.2.0)
sprockets (3.3.4)
rack (~> 1.0)
sprockets-rails (2.3.2)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
@ -600,7 +600,7 @@ DEPENDENCIES
que (= 0.10.0)
que-web (= 0.4.0)
railroady (= 1.3.0)
rails (= 4.2.3)
rails (= 4.2.4)
rails-settings-cached (= 0.4.1)
rake
ransack (= 1.5.1)

View file

@ -15,8 +15,8 @@ class EppController < ApplicationController
code: 2001,
msg: error
}
response.headers['X-EPP-Returncode'] = '2200'
end
handle_errors and return if epp_errors.any?
end

View file

@ -23,4 +23,10 @@ class ApplicationMailer < ActionMailer::Base
"BY MODEL OBJECT: id ##{model.try(:id)} deliver_emails returned false"
true
end
def format(email)
local, host = email.split('@')
host = SimpleIDN.to_ascii(host)
"#{local}@#{host}"
end
end

View file

@ -6,7 +6,7 @@ class ContactMailer < ApplicationMailer
return if whitelist_blocked?(email)
begin
mail(to: email, subject: "#{I18n.t(:contact_email_update_subject)} [#{@contact.code}]")
mail(to: format(email), subject: "#{I18n.t(:contact_email_update_subject)} [#{@contact.code}]")
rescue EOFError,
IOError,
TimeoutError,

View file

@ -19,7 +19,7 @@ class DomainMailer < ApplicationMailer
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
return if whitelist_blocked?(@old_registrant.email)
mail(to: @old_registrant.email,
mail(to: format(@old_registrant.email),
subject: "#{I18n.t(:pending_update_request_for_old_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
@ -42,7 +42,7 @@ class DomainMailer < ApplicationMailer
@old_registrant = Registrant.find(@domain.registrant_id_was)
return if whitelist_blocked?(@new_registrant.email)
mail(to: @new_registrant.email,
mail(to: format(@new_registrant.email),
subject: "#{I18n.t(:pending_update_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
@ -52,7 +52,7 @@ class DomainMailer < ApplicationMailer
return if delivery_off?(@domain)
return if whitelist_blocked?(@domain.registrant_email)
mail(to: @domain.registrant_email,
mail(to: format(@domain.registrant_email),
subject: "#{I18n.t(:registrant_updated_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
@ -64,7 +64,7 @@ class DomainMailer < ApplicationMailer
@old_registrant_email = domain.registrant_email # Nb! before applying pending updates
return if whitelist_blocked?(@old_registrant_email)
mail(to: @old_registrant_email,
mail(to: format(@old_registrant_email),
subject: "#{I18n.t(:registrant_updated_notification_for_old_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
@ -77,7 +77,7 @@ class DomainMailer < ApplicationMailer
@new_registrant_name = @domain.pending_json['new_registrant_name']
return if whitelist_blocked?(@new_registrant_email)
mail(to: @new_registrant_email,
mail(to: format(@new_registrant_email),
subject: "#{I18n.t(:pending_update_rejected_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
@ -94,7 +94,7 @@ class DomainMailer < ApplicationMailer
logger.info "EMAIL NOT DELIVERED: no registrant email [pending_update_expired_notification_for_new_registrant]"
return
end
mail(to: @new_registrant_email,
mail(to: format(@new_registrant_email),
subject: "#{I18n.t(:pending_update_expired_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
@ -119,7 +119,7 @@ class DomainMailer < ApplicationMailer
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
return if whitelist_blocked?(@old_registrant.email)
mail(to: @old_registrant.email,
mail(to: format(@old_registrant.email),
subject: "#{I18n.t(:domain_pending_deleted_subject,
name: @domain.name)} [#{@domain.name}]")
end
@ -139,7 +139,7 @@ class DomainMailer < ApplicationMailer
end
return if whitelist_blocked?(@domain.registrant.email)
mail(to: @domain.registrant.email,
mail(to: format(@domain.registrant.email),
subject: "#{I18n.t(:pending_delete_rejected_notification_subject,
name: @domain.name)} [#{@domain.name}]")
end
@ -149,7 +149,7 @@ class DomainMailer < ApplicationMailer
# no delivery off control, driggered by cron, no epp request
return if whitelist_blocked?(@domain.registrant.email)
mail(to: @domain.registrant.email,
mail(to: format(@domain.registrant.email),
subject: "#{I18n.t(:pending_delete_expired_notification_subject,
name: @domain.name)} [#{@domain.name}]")
end
@ -158,7 +158,7 @@ class DomainMailer < ApplicationMailer
@domain = domain
return if whitelist_blocked?(@domain.registrant.email)
mail(to: @domain.registrant.email,
mail(to: format(@domain.registrant.email),
subject: "#{I18n.t(:delete_confirmation_subject,
name: @domain.name)} [#{@domain.name}]")
end

View file

@ -4,6 +4,6 @@ class InvoiceMailer < ApplicationMailer
@invoice = invoice
attachments[invoice.pdf_name] = pdf
mail(to: invoice.billing_email, subject: invoice)
mail(to: format(invoice.billing_email), subject: invoice)
end
end

View file

@ -10,12 +10,13 @@ class Domain < ActiveRecord::Base
belongs_to :registrar
belongs_to :registrant
has_many :domain_contacts, dependent: :destroy
has_many :admin_domain_contacts
accepts_nested_attributes_for :admin_domain_contacts, allow_destroy: true
has_many :tech_domain_contacts
accepts_nested_attributes_for :tech_domain_contacts, allow_destroy: true
# NB! contacts, admin_contacts, tech_contacts are empty for a new record
has_many :domain_contacts, dependent: :destroy
has_many :contacts, through: :domain_contacts, source: :contact
has_many :admin_contacts, through: :admin_domain_contacts, source: :contact
has_many :tech_contacts, through: :tech_domain_contacts, source: :contact
@ -230,7 +231,7 @@ class Domain < ActiveRecord::Base
domains = Domain.where('valid_to <= ?', Time.zone.now)
domains.each do |domain|
next unless domain.expirable?
domain.set_expired
domain.set_graceful_expired
STDOUT << "#{Time.zone.now.utc} Domain.start_expire_period: ##{domain.id} #{domain.changes}\n" unless Rails.env.test?
domain.save(validate: false)
end
@ -320,7 +321,12 @@ class Domain < ActiveRecord::Base
def expirable?
return false if valid_to > Time.zone.now
!statuses.include?(DomainStatus::EXPIRED)
if statuses.include?(DomainStatus::EXPIRED) && outzone_at.present? && delete_at.present?
return false
end
true
end
def server_holdable?
@ -545,8 +551,6 @@ class Domain < ActiveRecord::Base
self.registered_at = Time.zone.now
self.valid_from = Time.zone.now
self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit)
self.outzone_at = valid_to + Setting.expire_warning_period.days
self.delete_at = outzone_at + Setting.redemption_grace_period.days
end
# rubocop:disable Metrics/AbcSize
@ -603,6 +607,13 @@ class Domain < ActiveRecord::Base
save(validate: false)
end
def set_graceful_expired
self.outzone_at = valid_to + Setting.expire_warning_period.days
self.delete_at = outzone_at + Setting.redemption_grace_period.days
statuses << DomainStatus::EXPIRED
end
# TODO: This looks odd - outzone_at and delete_at will be the same value?
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)
@ -675,7 +686,6 @@ class Domain < ActiveRecord::Base
end
def manage_automatic_statuses
# domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if delete_candidateable?
if statuses.empty? && valid?
statuses << DomainStatus::OK
elsif statuses.length > 1 || !valid?

View file

@ -17,7 +17,7 @@ class DomainContact < ActiveRecord::Base
end
def name
return 'Tech' if type == 'TechDomainContact'
return 'Tech' if type == 'TechDomainContact'
return 'Admin' if type == 'AdminDomainContact'
''
end

View file

@ -19,7 +19,16 @@ class Epp::Domain < Domain
before_save :link_contacts
def link_contacts
# Based on bullet report
unlinked_contacts = contacts.select { |c| !c.linked? } # speed up a bit
if new_record?
# new record does not have correct instance contacts entries thanks to epp
unlinked_contacts = [registrant]
unlinked_contacts << admin_domain_contacts.map(&:contact)
unlinked_contacts << tech_domain_contacts.map(&:contact)
unlinked_contacts.flatten!
else
unlinked_contacts = contacts.select { |c| !c.linked? } # speed up a bit
end
unlinked_contacts.each do |uc|
uc.domains_present = true # no need to fetch domains again
uc.save(validate: false)
@ -490,8 +499,8 @@ class Epp::Domain < Domain
p = self.class.convert_period_to_time(period, unit)
self.valid_to = valid_to + p
self.outzone_at = valid_to + Setting.expire_warning_period.days
self.delete_at = outzone_at + Setting.redemption_grace_period.days
self.outzone_at = nil
self.delete_at = nil
self.period = period
self.period_unit = unit

View file

@ -33,13 +33,15 @@
%td
%p
- domain.statuses.each do |s|
= s
- notes = domain.status_notes[s]
- if notes
%br
%i= notes
%br
- if domain.statuses.present?
- domain.statuses.each do |s|
= s
- if domain.status_notes.present?
- notes = domain.status_notes[s]
- if notes
%br
%i= notes
%br
- if domain.pending_json.present?
%p
= link_to t(:pending_epp), '#', class: 'js-pending-toggle'

File diff suppressed because it is too large Load diff

View file

@ -23,25 +23,25 @@ Content-Type: application/json
```
HTTP/1.1 200
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 524
Content-Length: 564
Content-Type: application/json
{
"contacts": [
{
"id": 1,
"code": "sh523328490",
"code": "REGISTRAR2:SH022086480",
"phone": "+372.12345678",
"email": "corene_koch@caspermoen.net",
"email": "hoyt@deckowbechtelar.net",
"fax": null,
"created_at": "2015-04-16T08:48:39.551Z",
"updated_at": "2015-04-16T08:48:39.551Z",
"created_at": "2015-09-09T09:11:14.130Z",
"updated_at": "2015-09-09T09:11:14.130Z",
"ident": "37605030299",
"ident_type": "priv",
"auth_info": "password",
"name": "Alana Williamson II0",
"name": "Karson Kessler0",
"org_name": null,
"registrar_id": 1,
"registrar_id": 2,
"creator_str": null,
"updator_str": null,
"ident_country_code": "EE",
@ -50,7 +50,12 @@ Content-Type: application/json
"zip": "11111",
"country_code": "EE",
"state": null,
"legacy_id": null
"legacy_id": null,
"statuses": [
"ok"
],
"status_notes": {
}
}
],
"total_number_of_records": 2
@ -74,12 +79,12 @@ Content-Type: application/json
```
HTTP/1.1 200
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 56
Content-Length: 67
Content-Type: application/json
{
"contacts": [
"sh629765881"
"REGISTRAR2:SH749456461"
],
"total_number_of_records": 2
}

View file

@ -23,7 +23,7 @@ Content-Type: application/json
```
HTTP/1.1 200
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 578
Content-Length: 808
Content-Type: application/json
{
@ -31,25 +31,40 @@ Content-Type: application/json
{
"id": 1,
"name": "domain0.ee",
"registrar_id": 1,
"registered_at": "2015-04-16T08:48:39.995Z",
"registrar_id": 2,
"registered_at": "2015-09-09T09:11:14.861Z",
"status": null,
"valid_from": "2015-04-16T00:00:00.000Z",
"valid_to": "2016-04-16T00:00:00.000Z",
"valid_from": "2015-09-09T09:11:14.861Z",
"valid_to": "2016-09-09T09:11:14.861Z",
"registrant_id": 1,
"auth_info": "3ec9a29d618023920b61758c339b638f",
"created_at": "2015-04-16T08:48:39.992Z",
"updated_at": "2015-04-16T08:48:39.991Z",
"auth_info": "98oiewslkfkd",
"created_at": "2015-09-09T09:11:14.861Z",
"updated_at": "2015-09-09T09:11:14.860Z",
"name_dirty": "domain0.ee",
"name_puny": "domain0.ee",
"period": 1,
"period_unit": "y",
"creator_str": null,
"updator_str": null,
"whois_body": null,
"legacy_id": null,
"legacy_registrar_id": null,
"legacy_registrant_id": null
"legacy_registrant_id": null,
"outzone_at": "2016-09-24T09:11:14.861Z",
"delete_at": "2016-10-24T09:11:14.861Z",
"registrant_verification_asked_at": null,
"registrant_verification_token": null,
"pending_json": {
},
"force_delete_at": null,
"statuses": [
"ok"
],
"reserved": false,
"status_notes": {
},
"statuses_backup": [
]
}
],
"total_number_of_records": 2

View file

@ -38,7 +38,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'serverDeleteProhibited': [
'clientDeleteProhibited',
@ -57,7 +57,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'clientHold': [
'clientDeleteProhibited',
@ -75,7 +75,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'serverHold': [
'clientDeleteProhibited',
@ -93,7 +93,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'clientRenewProhibited': [
'clientDeleteProhibited',
@ -117,7 +117,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'serverRenewProhibited': [
'clientDeleteProhibited',
@ -141,7 +141,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'clientTransferProhibited': [
'clientDeleteProhibited',
@ -165,7 +165,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'serverTransferProhibited': [
'clientDeleteProhibited',
@ -189,7 +189,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'clientUpdateProhibited': [
'clientDeleteProhibited',
@ -213,7 +213,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'serverUpdateProhibited': [
'clientDeleteProhibited',
@ -237,7 +237,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'pendingCreate': [
'clientDeleteProhibited',
@ -257,7 +257,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'pendingDelete': [
'clientHold',
@ -276,7 +276,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'pendingRenew': [
'clientDeleteProhibited',
@ -294,7 +294,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'pendingTransfer': [
@ -313,7 +313,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'pendingUpdate': [
'clientDeleteProhibited',
@ -331,7 +331,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'serverManualInzone': [
'clientDeleteProhibited',
@ -355,7 +355,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'serverRegistrantChangeProhibited': [
'clientDeleteProhibited',
@ -380,7 +380,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'serverAdminChangeProhibited': [
'clientDeleteProhibited',
@ -405,7 +405,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'serverTechChangeProhibited': [
'clientDeleteProhibited',
@ -430,7 +430,7 @@ task statuses: [:environment] do
'serverAdminChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'forceDelete': [
'clientHold',
@ -441,7 +441,7 @@ task statuses: [:environment] do
'serverAdminChangeProhibited',
'serverTechChangeProhibited',
'deleteCandidate',
'expired',
'expired'
],
'deleteCandidate': [
'clientDeleteProhibited',
@ -467,7 +467,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'expired',
'expired'
],
'expired': [
'clientDeleteProhibited',
@ -492,13 +492,13 @@ task statuses: [:environment] do
'serverAdminChangeProhibited',
'serverTechChangeProhibited',
'forceDelete',
'deleteCandidate',
'deleteCandidate'
]
}
puts "\nDomain status can be with other statuses map\n"
puts "---------------------------------------------"
statuses.each do |s,v|
statuses.each do |s, _v|
puts "\n#{s} =>"
statuses[s].map { |u| puts " #{u}" }
puts
@ -520,7 +520,7 @@ task statuses: [:environment] do
'serverUpdateProhibited',
'pendingCreate',
'pendingTransfer',
'pendingUpdate',
'pendingUpdate'
],
'serverDeleteProhibited': [
'linked',
@ -531,7 +531,7 @@ task statuses: [:environment] do
'serverUpdateProhibited',
'pendingCreate',
'pendingTransfer',
'pendingUpdate',
'pendingUpdate'
],
'clientTransferProhibited': [
'linked',
@ -542,7 +542,7 @@ task statuses: [:environment] do
'serverUpdateProhibited',
'pendingCreate',
'pendingDelete',
'pendingUpdate',
'pendingUpdate'
],
'serverTransferProhibited': [
'linked',
@ -553,7 +553,7 @@ task statuses: [:environment] do
'serverUpdateProhibited',
'pendingCreate',
'pendingDelete',
'pendingUpdate',
'pendingUpdate'
],
'clientUpdateProhibited': [
'linked',
@ -564,7 +564,7 @@ task statuses: [:environment] do
'serverUpdateProhibited',
'pendingCreate',
'pendingDelete',
'pendingTransfer',
'pendingTransfer'
],
'serverUpdateProhibited': [
'linked',
@ -575,7 +575,7 @@ task statuses: [:environment] do
'clientUpdateProhibited',
'pendingCreate',
'pendingDelete',
'pendingTransfer',
'pendingTransfer'
],
'pendingCreate': [
'linked',
@ -584,7 +584,7 @@ task statuses: [:environment] do
'clientTransferProhibited',
'serverTransferProhibited',
'clientUpdateProhibited',
'serverUpdateProhibited',
'serverUpdateProhibited'
],
'pendingDelete': [
'linked',
@ -593,7 +593,7 @@ task statuses: [:environment] do
'clientTransferProhibited',
'serverTransferProhibited',
'clientUpdateProhibited',
'serverUpdateProhibited',
'serverUpdateProhibited'
],
'pendingTransfer': [
'linked',
@ -602,7 +602,7 @@ task statuses: [:environment] do
'clientTransferProhibited',
'serverTransferProhibited',
'clientUpdateProhibited',
'serverUpdateProhibited',
'serverUpdateProhibited'
],
'pendingUpdate': [
'linked',
@ -611,13 +611,13 @@ task statuses: [:environment] do
'clientTransferProhibited',
'serverTransferProhibited',
'clientUpdateProhibited',
'serverUpdateProhibited',
],
'serverUpdateProhibited'
]
}
puts "\n\nContact status can be with other statuses map\n"
puts "---------------------------------------------"
contact_statuses.each do |s,v|
contact_statuses.each do |s, _v|
puts "\n#{s} =>"
contact_statuses[s].map { |u| puts " #{u}" }
puts

View file

@ -16,15 +16,44 @@ namespace :whois do
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
end
# desc 'Delete whois database data and import from Registry master database (faster)'
# task export: :environment do
# start = Time.zone.now.to_f
# print "-----> Delete whois database data and import from Registry whois_records table..."
# whois_records = WhoisRecord.pluck(:name, :body, :json)
# Whois::Record.delete_all
# Whois::Record.import([:name, :body, :json], whois_records)
# puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
# end
desc 'Create whois database'
task create: [:environment] do
whois_db = "whois_#{Rails.env}"
begin
puts "\n------------------------ Create #{whois_db} ---------------------------------------\n"
ActiveRecord::Base.clear_all_connections!
conf = ActiveRecord::Base.configurations
ActiveRecord::Base.connection.create_database(conf[whois_db]['database'].to_sym, conf[whois_db])
rescue => e
puts "\n#{e}"
end
end
desc 'Drop whois database'
task drop: [:environment] do
# just in case we allow only drop test, comment it out only for temp
if Rails.env.test?
whois_db = "whois_#{Rails.env}"
begin
puts "\n------------------------ #{whois_db} drop ------------------------------\n"
ActiveRecord::Base.clear_all_connections!
ActiveRecord::Base.establish_connection(whois_db.to_sym)
conf = ActiveRecord::Base.configurations
if ActiveRecord::Tasks::DatabaseTasks.drop(conf[whois_db])
puts "#{conf[whois_db]['database']} dropped"
else
puts "Didn't find database #{whois_db}, no drop"
end
rescue => e
puts "\n#{e}"
end
else
puts 'Only for test'
end
end
namespace :schema do
desc 'Load whois schema into empty whois database'

View file

@ -2426,10 +2426,8 @@ describe 'EPP Domain', epp: true do
domain.reload
domain.valid_to.should be_within(1).of(exp_date + 1.year)
domain.outzone_at.should be_within(1).of(exp_date + 1.year + Setting.expire_warning_period.days)
domain.delete_at.should be_within(1).of(
exp_date + 1.year + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
)
domain.outzone_at.should be_nil
domain.delete_at.should be_nil
@registrar1.balance.should == old_balance - 15.0
@registrar1.cash_account.account_activities.count.should == old_activities + 1
@ -2485,10 +2483,8 @@ describe 'EPP Domain', epp: true do
domain.reload
domain.valid_to.should be_within(1).of(exp_date + 1.year)
domain.outzone_at.should be_within(1).of(exp_date + 1.year + Setting.expire_warning_period.days)
domain.delete_at.should be_within(1).of(
exp_date + 1.year + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
)
domain.outzone_at.should be_nil
domain.delete_at.should be_nil
@registrar1.balance.should == old_balance - 15.0
@registrar1.cash_account.account_activities.count.should == old_activities + 1
@ -2764,10 +2760,8 @@ describe 'EPP Domain', epp: true do
domain.reload
domain.valid_to.should be_within(5).of(old_valid_to + 1.year)
domain.outzone_at.should be_within(5).of(old_valid_to + 1.year + Setting.expire_warning_period.days)
domain.delete_at.should be_within(5).of(
old_valid_to + 1.year + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
)
domain.outzone_at.should be_nil
domain.delete_at.should be_nil
end
it 'does not renew foreign domain' do

View file

@ -1,6 +1,10 @@
require 'rails_helper'
describe ContactMailer do
before :all do
Fabricate(:zonefile_setting, origin: 'ee')
end
describe 'email changed notification when delivery turned off' do
before :all do
@contact = Fabricate(:contact, email: 'test@example.ee')
@ -26,7 +30,6 @@ describe ContactMailer do
describe 'email changed notification' do
before :all do
Fabricate(:zonefile_setting, origin: 'ee')
@domain = Fabricate(:domain)
@contact = @domain.registrant
@contact.reload # until figured out why registrant_domains not loaded
@ -50,4 +53,30 @@ describe ContactMailer do
@mail.body.encoded.should =~ /Kontaktandmed:/
end
end
describe 'email with pynicode' do
before :all do
@domain = Fabricate(:domain)
@contact = @domain.registrant
@contact.reload # until figured out why registrant_domains not loaded
@contact.deliver_emails = true
@mail = ContactMailer.email_updated('info@ääöü.org', @contact)
end
it 'should render email subject' do
@mail.subject.should =~ /Teie domeenide kontakt epostiaadress on muutunud/
end
it 'should have sender email' do
@mail.from.should == ["noreply@internet.ee"]
end
it 'should send to info email' do
@mail.to.should == ['info@xn--4caa8cya.org']
end
it 'should render body' do
@mail.body.encoded.should =~ /Kontaktandmed:/
end
end
end

View file

@ -82,10 +82,8 @@ describe Domain do
it 'should have correct validity dates' do
valid_to = Time.zone.now + 1.year
@domain.valid_to.should be_within(5).of(valid_to)
@domain.outzone_at.should be_within(5).of(valid_to + Setting.expire_warning_period.days)
@domain.delete_at.should be_within(5).of(
valid_to + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
)
@domain.outzone_at.should be_nil
@domain.delete_at.should be_nil
end
it 'should validate uniqueness of tech contacts' do
@ -146,18 +144,39 @@ describe Domain do
Domain.start_expire_period
@domain.statuses.include?(DomainStatus::EXPIRED).should == false
@domain.valid_to = Time.zone.now - 10.days
old_valid_to = Time.zone.now - 10.days
@domain.valid_to = old_valid_to
@domain.save
Domain.start_expire_period
@domain.reload
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
@domain.outzone_at.should be_within(5).of(old_valid_to + Setting.expire_warning_period.days)
@domain.delete_at.should be_within(5).of(
old_valid_to + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
)
Domain.start_expire_period
@domain.reload
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
end
it 'should start redemption grace period' do
old_valid_to = Time.zone.now - 10.days
@domain.valid_to = old_valid_to
@domain.statuses = [DomainStatus::EXPIRED]
@domain.outzone_at, @domain.delete_at = nil, nil
@domain.save
Domain.start_expire_period
@domain.reload
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
@domain.outzone_at.should be_within(5).of(old_valid_to + Setting.expire_warning_period.days)
@domain.delete_at.should be_within(5).of(
old_valid_to + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
)
end
it 'should start redemption grace period' do
Domain.start_redemption_grace_period
@domain.reload

View file

@ -3,7 +3,8 @@ require 'rails_helper'
describe Repp::AccountV1 do
it 'should fail without whitelisted IP' do
ENV['webclient_ips'] = '192.188.1.1'
@registrar1 = Fabricate(:registrar, white_ips: [Fabricate(:white_ip_registrar)])
Setting.api_ip_whitelist_enabled = true
@registrar1 = Fabricate(:registrar, white_ips: [Fabricate(:white_ip_registrar, ipv4: '99.99.99.99')])
@api_user = Fabricate(:api_user, registrar: @registrar1)
get_with_auth '/repp/v1/accounts/balance', {}, @api_user
@ -12,6 +13,7 @@ describe Repp::AccountV1 do
body['error'].should == 'IP is not whitelisted'
ENV['webclient_ips'] = '127.0.0.1'
Setting.api_ip_whitelist_enabled = false
end
context 'with valid registrar' do

View file

@ -79,7 +79,7 @@ module Epp
res = parse_response(server.send_request(data))
if res
log(data, res[:parsed])
log(data, res[:raw])
if validate_output && @xsd
@xsd.validate(Nokogiri(res[:raw])).each do |error|
fail Exception.new, error.to_s
@ -364,7 +364,7 @@ module Epp
def log(req, res)
return unless ENV['EPP_DOC']
puts "REQUEST:\n\n```xml\n#{Nokogiri(req)}```\n\n"
puts "RESPONSE:\n\n```xml\n#{res}```\n\n"
puts "RESPONSE:\n\n```xml\n#{Nokogiri(res)}```\n\n"
end
end