Merge branch 'alpha' into staging

This commit is contained in:
Priit Tark 2015-08-12 14:23:39 +03:00
commit d13c3e2c87
157 changed files with 5299 additions and 2777 deletions

View file

@ -8,7 +8,7 @@ end if Bundler::VERSION < '2'
source 'https://rubygems.org' source 'https://rubygems.org'
# core # core
gem 'rails', '4.2.3' gem 'rails', '4.2.3' # when update, all initializers eis_custom files needs check/update
gem 'iso8601', '~> 0.8.2' # for dates and times gem 'iso8601', '~> 0.8.2' # for dates and times
gem 'hashie-forbidden_attributes', '~> 0.1.1' gem 'hashie-forbidden_attributes', '~> 0.1.1'
@ -82,7 +82,7 @@ gem 'digidoc_client', '~> 0.2.1'
# epp # epp
gem 'epp', '~> 1.4.2', github: 'internetee/epp' gem 'epp', '~> 1.4.2', github: 'internetee/epp'
gem 'epp-xml', '~> 1.0.3' # EIS EPP XMLs gem 'epp-xml', '~> 1.0.4' # EIS EPP XMLs
gem 'uuidtools', '~> 2.1.4' # For unique IDs (used by the epp gem) gem 'uuidtools', '~> 2.1.4' # For unique IDs (used by the epp gem)
# que # que

View file

@ -177,7 +177,7 @@ GEM
nokogiri (>= 1.4.0) nokogiri (>= 1.4.0)
savon (>= 2.4.0) savon (>= 2.4.0)
docile (1.1.5) docile (1.1.5)
epp-xml (1.0.3) epp-xml (1.0.4)
activesupport (~> 4.1) activesupport (~> 4.1)
builder (~> 3.2) builder (~> 3.2)
equalizer (0.0.11) equalizer (0.0.11)
@ -564,7 +564,7 @@ DEPENDENCIES
devise (~> 3.5.1) devise (~> 3.5.1)
digidoc_client (~> 0.2.1) digidoc_client (~> 0.2.1)
epp (~> 1.4.2)! epp (~> 1.4.2)!
epp-xml (~> 1.0.3) epp-xml (~> 1.0.4)
fabrication (~> 2.13.2) fabrication (~> 2.13.2)
faker (~> 1.4.3) faker (~> 1.4.3)
figaro (~> 1.1.1) figaro (~> 1.1.1)

View file

@ -8,5 +8,6 @@
#= require selectize #= require selectize
#= require shared/jquery.validate.bootstrap #= require shared/jquery.validate.bootstrap
#= require jquery-ui/datepicker #= require jquery-ui/datepicker
#= require select2
#= require shared/general #= require shared/general
#= require admin/application #= require admin/application

View file

@ -22,8 +22,7 @@ $(document).on 'page:change', ->
tomorrow.setDate(today.getDate() + 1) tomorrow.setDate(today.getDate() + 1)
$('.datepicker').datepicker( $('.datepicker').datepicker(
dateFormat: "yy-mm-dd", dateFormat: "yy-mm-dd"
maxDate: tomorrow
) )
if $('.js-combobox').length if $('.js-combobox').length

View file

@ -1,6 +1,8 @@
//= require 'shared/general-manifest' //= require 'shared/general-manifest'
//= require 'admin/admin-bootstrap' //= require 'admin/admin-bootstrap'
//= require 'jquery-ui/datepicker' //= require 'jquery-ui/datepicker'
//= require 'select2'
//= require 'select2-bootstrap'
@import shared/fonts @import shared/fonts
@import shared/general @import shared/general
@import nprogress @import nprogress

View file

@ -2,11 +2,40 @@ class Admin::DomainsController < AdminController
load_and_authorize_resource load_and_authorize_resource
before_action :set_domain, only: [:show, :edit, :update, :zonefile] before_action :set_domain, only: [:show, :edit, :update, :zonefile]
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
def index def index
@q = Domain.includes(:registrar, :registrant).search(params[:q]) params[:q] ||= {}
@domains = @q.result.page(params[:page]) if params[:statuses_contains]
domains = Domain.includes(:registrar, :registrant).where(
"statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
)
else
domains = Domain.includes(:registrar, :registrant)
end end
normalize_search_parameters do
@q = domains.search(params[:q])
@domains = @q.result.page(params[:page])
if @domains.count == 1
redirect_to [:admin, @domains.first] and return
elsif @domains.count == 0 && params[:q][:name_matches] !~ /^%.+%$/
# if we do not get any results, add wildcards to the name field and search again
n_cache = params[:q][:name_matches]
params[:q][:name_matches] = "%#{params[:q][:name_matches]}%"
@q = domains.search(params[:q])
@domains = @q.result.page(params[:page])
params[:q][:name_matches] = n_cache # we don't want to show wildcards in search form
end
end
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
def show def show
@domain.valid? @domain.valid?
end end
@ -71,5 +100,19 @@ class Admin::DomainsController < AdminController
dp[:statuses].reject!(&:blank?) dp[:statuses].reject!(&:blank?)
dp dp
end end
def normalize_search_parameters
ca_cache = params[:q][:valid_to_lteq]
begin
end_time = params[:q][:valid_to_lteq].try(:to_date)
params[:q][:valid_to_lteq] = end_time.try(:end_of_day)
rescue
logger.warn('Invalid date')
end
yield
params[:q][:valid_to_lteq] = ca_cache
end
end end

View file

@ -12,7 +12,7 @@ class Admin::InvoicesController < AdminController
@deposit = Deposit.new(deposit_params.merge(registrar: r)) @deposit = Deposit.new(deposit_params.merge(registrar: r))
@invoice = @deposit.issue_prepayment_invoice @invoice = @deposit.issue_prepayment_invoice
if @invoice.persisted? if @invoice && @invoice.persisted?
flash[:notice] = t(:record_created) flash[:notice] = t(:record_created)
redirect_to [:admin, @invoice] redirect_to [:admin, @invoice]
else else

View file

@ -4,6 +4,8 @@ class Admin::PricelistsController < AdminController
def index def index
@q = Pricelist.search(params[:q]) @q = Pricelist.search(params[:q])
@q.sorts = ['category asc', 'duration asc', 'operation_category asc',
'valid_from desc', 'valid_to asc'] if @q.sorts.empty?
@pricelists = @q.result.page(params[:page]) @pricelists = @q.result.page(params[:page])
end end

View file

@ -53,6 +53,7 @@ class Admin::SettingsController < AdminController
:transfer_wait_time, :transfer_wait_time,
:invoice_number_min, :invoice_number_min,
:invoice_number_max, :invoice_number_max,
:days_to_keep_invoices_active,
:days_to_keep_overdue_invoices_active, :days_to_keep_overdue_invoices_active,
:days_to_renew_domain_before_expire, :days_to_renew_domain_before_expire,
:expire_warning_period, :expire_warning_period,
@ -67,7 +68,9 @@ class Admin::SettingsController < AdminController
:key_data_allowed, :key_data_allowed,
:client_side_status_editing_enabled, :client_side_status_editing_enabled,
:registrar_ip_whitelist_enabled, :registrar_ip_whitelist_enabled,
:api_ip_whitelist_enabled :api_ip_whitelist_enabled,
:request_confrimation_on_registrant_change_enabled,
:request_confirmation_on_domain_deletion_enabled
] ]
params[:settings].each do |k, v| params[:settings].each do |k, v|

View file

@ -56,15 +56,7 @@ class ApplicationController < ActionController::Base
end end
def user_for_paper_trail def user_for_paper_trail
if defined?(current_user) && current_user.present? user_log_str(current_user)
# Most of the time it's not loaded in correct time because PaperTrail before filter kicks in
# before current_user is defined. PaperTrail is triggered also at current_user
api_user_log_str(current_user)
elsif current_user.present?
"#{current_user.id}-#{current_user.username}"
else
'public'
end
end end
def depp_current_user def depp_current_user
@ -74,11 +66,8 @@ class ApplicationController < ActionController::Base
) )
end end
def api_user_log_str(user) def user_log_str(user)
if user.present? return 'public' if user.nil?
"#{user.id}-api-#{user.username}" "#{user.id}-#{user.class}: #{user.username}"
else
'api-public'
end
end end
end end

View file

@ -196,13 +196,22 @@ class Epp::DomainsController < EppController
end end
def validate_transfer def validate_transfer
# period element is disabled for now
if params[:parsed_frame].css('period').any?
epp_errors << {
code: '2307',
msg: I18n.t(:unimplemented_object_service),
value: { obj: 'period' }
}
end
requires 'transfer > transfer' requires 'transfer > transfer'
@prefix = 'transfer > transfer >' @prefix = 'transfer > transfer >'
requires 'name' requires 'name'
@prefix = nil @prefix = nil
requires_attribute 'transfer', 'op', values: %(approve, query, reject, request) requires_attribute 'transfer', 'op', values: %(approve, query, reject, request, cancel)
end end
def find_domain def find_domain

View file

@ -75,8 +75,8 @@ class Epp::SessionsController < EppController
end end
if success if success
if parsed_frame.css('newPW').first if params[:parsed_frame].css('newPW').first
unless @api_user.update(password: parsed_frame.css('newPW').first.text) unless @api_user.update(password: params[:parsed_frame].css('newPW').first.text)
response.headers['X-EPP-Returncode'] = '2500' response.headers['X-EPP-Returncode'] = '2500'
handle_errors(@api_user) and return handle_errors(@api_user) and return
end end
@ -124,11 +124,8 @@ class Epp::SessionsController < EppController
### HELPER METHODS ### ### HELPER METHODS ###
def login_params def login_params
ph = params_hash['epp']['command']['login'] user = params[:parsed_frame].css('clID').first.text
{ username: ph[:clID], password: ph[:pw] } pw = params[:parsed_frame].css('pw').first.text
end { username: user, password: pw }
def parsed_frame
@parsed_frame ||= Nokogiri::XML(request.params[:raw_frame]).remove_namespaces!
end end
end end

View file

@ -6,6 +6,20 @@ class EppController < ApplicationController
before_action :generate_svtrid before_action :generate_svtrid
before_action :latin_only before_action :latin_only
before_action :validate_against_schema
def validate_against_schema
return if ['hello', 'error', 'keyrelay'].include?(params[:action])
schema.validate(params[:nokogiri_frame]).each do |error|
epp_errors << {
code: 2001,
msg: error
}
end
handle_errors and return if epp_errors.any?
end
before_action :validate_request before_action :validate_request
before_action :update_epp_session before_action :update_epp_session
@ -43,7 +57,8 @@ class EppController < ApplicationController
if Rails.env.test? || Rails.env.development? if Rails.env.test? || Rails.env.development?
# rubocop:disable Rails/Output # rubocop:disable Rails/Output
puts e.backtrace.reverse.join("\n") puts e.backtrace.reverse.join("\n")
puts "\nFROM-EPP-RESCUE: #{e.message}\n" puts "\n BACKTRACE REVERSED!\n"
puts "\n FROM-EPP-RESCUE: #{e.message}\n\n\n"
# rubocop:enable Rails/Output # rubocop:enable Rails/Output
else else
logger.error "FROM-EPP-RESCUE: #{e.message}" logger.error "FROM-EPP-RESCUE: #{e.message}"
@ -57,6 +72,13 @@ class EppController < ApplicationController
render_epp_response '/epp/error' render_epp_response '/epp/error'
end end
def schema
# TODO: Support multiple schemas
return DOMAIN_SCHEMA if params[:epp_object_type] == :domain
return CONTACT_SCHEMA if params[:epp_object_type] == :contact
EPP_SCHEMA
end
def generate_svtrid def generate_svtrid
# rubocop: disable Style/VariableName # rubocop: disable Style/VariableName
@svTRID = "ccReg-#{format('%010d', rand(10**10))}" @svTRID = "ccReg-#{format('%010d', rand(10**10))}"
@ -98,7 +120,7 @@ class EppController < ApplicationController
@current_user ||= ApiUser.find_by_id(epp_session[:api_user_id]) @current_user ||= ApiUser.find_by_id(epp_session[:api_user_id])
# by default PaperTrail uses before filter and at that # by default PaperTrail uses before filter and at that
# time current_user is not yet present # time current_user is not yet present
::PaperTrail.whodunnit = api_user_log_str(@current_user) ::PaperTrail.whodunnit = user_log_str(@current_user)
::PaperSession.session = epp_session.session_id if epp_session.session_id.present? ::PaperSession.session = epp_session.session_id if epp_session.session_id.present?
@current_user @current_user
end end
@ -328,6 +350,7 @@ class EppController < ApplicationController
# rubocop: enable Style/PredicateName # rubocop: enable Style/PredicateName
# rubocop: disable Metrics/CyclomaticComplexity # rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
def write_to_epp_log def write_to_epp_log
# return nil if EPP_LOG_ENABLED # return nil if EPP_LOG_ENABLED
request_command = params[:command] || params[:action] # error receives :command, other methods receive :action request_command = params[:command] || params[:action] # error receives :command, other methods receive :action
@ -344,12 +367,13 @@ class EppController < ApplicationController
request_successful: epp_errors.empty?, request_successful: epp_errors.empty?,
request_object: params[:epp_object_type], request_object: params[:epp_object_type],
response: @response, response: @response,
api_user_name: api_user_log_str(@api_user || current_user), api_user_name: @api_user.try(:username) || current_user.try(:username) || 'api-public',
api_user_registrar: @api_user.try(:registrar).try(:to_s) || current_user.try(:registrar).try(:to_s), api_user_registrar: @api_user.try(:registrar).try(:to_s) || current_user.try(:registrar).try(:to_s),
ip: request.ip ip: request.ip
}) })
end end
# rubocop: enable Metrics/CyclomaticComplexity # rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/PerceivedComplexity
def iptables_counter_update def iptables_counter_update
return if ENV['iptables_counter_enabled'].blank? && ENV['iptables_counter_enabled'] != 'true' return if ENV['iptables_counter_enabled'].blank? && ENV['iptables_counter_enabled'] != 'true'

View file

@ -9,7 +9,7 @@ class Registrar::DepositsController < RegistrarController
@deposit = Deposit.new(deposit_params.merge(registrar: current_user.registrar)) @deposit = Deposit.new(deposit_params.merge(registrar: current_user.registrar))
@invoice = @deposit.issue_prepayment_invoice @invoice = @deposit.issue_prepayment_invoice
if @invoice.persisted? if @invoice && @invoice.persisted?
flash[:notice] = t(:please_pay_the_following_invoice) flash[:notice] = t(:please_pay_the_following_invoice)
redirect_to [:registrar, @invoice] redirect_to [:registrar, @invoice]
else else

View file

@ -1,7 +1,10 @@
class Registrar::DeppController < RegistrarController # EPP controller class Registrar::DeppController < RegistrarController # EPP controller
helper_method :depp_current_user helper_method :depp_current_user
rescue_from(Errno::ECONNRESET, Errno::ECONNREFUSED) do |_exception| rescue_from(Errno::ECONNRESET, Errno::ECONNREFUSED) do |exception|
logger.error 'COULD NOT CONNECT TO REGISTRY'
logger.error exception.backtrace.join("\n")
NewRelic::Agent.notice_error(exception)
redirect_to registrar_login_url, alert: t(:no_connection_to_registry) redirect_to registrar_login_url, alert: t(:no_connection_to_registry)
end end

View file

@ -6,16 +6,16 @@ class Registrar::InvoicesController < RegistrarController
def index def index
params[:q] ||= {} params[:q] ||= {}
invoices = current_user.registrar.invoices.includes(:invoice_items, :account_activity) invoices = current_user.registrar.invoices.includes(:invoice_items, :account_activity)
params[:q][:sum_cache_gteq].gsub!(',', '.') if params[:q][:sum_cache_gteq]
params[:q][:sum_cache_lteq].gsub!(',', '.') if params[:q][:sum_cache_lteq] normalize_search_parameters do
@q = invoices.search(params[:q]) @q = invoices.search(params[:q])
@q.sorts = 'id desc' if @q.sorts.empty? @q.sorts = 'id desc' if @q.sorts.empty?
@invoices = @q.result.page(params[:page]) @invoices = @q.result.page(params[:page])
end end
def show
end end
def show; end
def forward def forward
@invoice.billing_email = @invoice.buyer.billing_email @invoice.billing_email = @invoice.buyer.billing_email
@ -51,4 +51,21 @@ class Registrar::InvoicesController < RegistrarController
def set_invoice def set_invoice
@invoice = Invoice.find(params[:id]) @invoice = Invoice.find(params[:id])
end end
def normalize_search_parameters
params[:q][:sum_cache_gteq].gsub!(',', '.') if params[:q][:sum_cache_gteq]
params[:q][:sum_cache_lteq].gsub!(',', '.') if params[:q][:sum_cache_lteq]
ca_cache = params[:q][:due_date_lteq]
begin
end_time = params[:q][:due_date_lteq].try(:to_date)
params[:q][:due_date_lteq] = end_time.try(:end_of_day)
rescue
logger.warn('Invalid date')
end
yield
params[:q][:due_date_lteq] = ca_cache
end
end end

View file

@ -64,6 +64,12 @@ class Registrar::SessionsController < Devise::SessionsController
# rubocop:enable Metrics/MethodLength # rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize # rubocop:enable Metrics/AbcSize
def switch_user
@api_user = ApiUser.find(params[:id])
sign_in @api_user if @api_user.identity_code == current_user.identity_code
redirect_to :back
end
def id def id
@user = ApiUser.find_by_idc_data(request.env['SSL_CLIENT_S_DN']) @user = ApiUser.find_by_idc_data(request.env['SSL_CLIENT_S_DN'])

View file

@ -8,6 +8,7 @@ class DomainDeleteConfirmJob < Que::Job
domain.apply_pending_delete! domain.apply_pending_delete!
domain.clean_pendings! domain.clean_pendings!
when RegistrantVerification::REJECTED when RegistrantVerification::REJECTED
DomainMailer.pending_delete_rejected_notification(domain).deliver_now
domain.clean_pendings! domain.clean_pendings!
end end
destroy # it's best to destroy the job in the same transaction destroy # it's best to destroy the job in the same transaction

View file

@ -8,6 +8,7 @@ class DomainUpdateConfirmJob < Que::Job
domain.apply_pending_update! domain.apply_pending_update!
domain.clean_pendings! domain.clean_pendings!
when RegistrantVerification::REJECTED when RegistrantVerification::REJECTED
DomainMailer.pending_update_rejected_notification_for_new_registrant(domain).deliver_now
domain.clean_pendings! domain.clean_pendings!
end end
destroy # it's best to destroy the job in the same transaction destroy # it's best to destroy the job in the same transaction

View file

@ -1,4 +1,5 @@
class ApplicationMailer < ActionMailer::Base class ApplicationMailer < ActionMailer::Base
append_view_path Rails.root.join('app', 'views', 'mailers')
default from: 'noreply@internet.ee' default from: 'noreply@internet.ee'
layout 'mailer' layout 'mailer'
@ -8,8 +9,8 @@ class ApplicationMailer < ActionMailer::Base
emails = [emails] unless emails.is_a?(Array) emails = [emails] unless emails.is_a?(Array)
emails = emails.flatten emails = emails.flatten
emails.each do |email| emails.each do |email|
next unless TEST_EMAILS.include?(email) next if TEST_EMAILS.include?(email)
logger.warn "EMAIL SENDING WAS BLOCKED BY WHITELIST: #{email}" logger.info "EMAIL SENDING WAS BLOCKED BY WHITELIST: #{email}"
return true return true
end end
false false
@ -18,7 +19,7 @@ class ApplicationMailer < ActionMailer::Base
# turn on delivery on specific (epp) request only, thus rake tasks does not deliver anything # turn on delivery on specific (epp) request only, thus rake tasks does not deliver anything
def delivery_off?(model) def delivery_off?(model)
return false if model.deliver_emails == true return false if model.deliver_emails == true
logger.warn "EMAIL SENDING WAS NOT ACTIVATED " \ logger.info "EMAIL SENDING WAS NOT ACTIVATED " \
"BY MODEL OBJECT: id ##{model.try(:id)} deliver_emails returned false" "BY MODEL OBJECT: id ##{model.try(:id)} deliver_emails returned false"
true true
end end

View file

@ -1,16 +1,10 @@
class ContactMailer < ApplicationMailer class ContactMailer < ApplicationMailer
# rubocop:disable Metrics/MethodLength def email_updated(email, contact)
def email_updated(contact)
return if delivery_off?(contact) return if delivery_off?(contact)
@contact = contact @contact = contact
emails = []
emails << [@contact.email, @contact.email_was] if @contact.registrant_domains.present?
emails << @contact.domains.map(&:registrant_email) if @contact.domains.present?
emails = emails.uniq
return if whitelist_blocked?(emails) return if whitelist_blocked?(email)
emails.each do |email|
begin begin
mail(to: email, subject: "#{I18n.t(:contact_email_update_subject)} [#{@contact.code}]") mail(to: email, subject: "#{I18n.t(:contact_email_update_subject)} [#{@contact.code}]")
rescue EOFError, rescue EOFError,
@ -26,9 +20,7 @@ class ContactMailer < ApplicationMailer
Net::SMTPSyntaxError, Net::SMTPSyntaxError,
Net::SMTPUnknownError, Net::SMTPUnknownError,
OpenSSL::SSL::SSLError => e OpenSSL::SSL::SSLError => e
logger.warn "EMAIL SENDING FAILED: #{email}: #{e}" logger.info "EMAIL SENDING FAILED: #{email}: #{e}"
end end
end end
end
# rubocop:enable Metrics/MethodLength
end end

View file

@ -1,5 +1,5 @@
class DomainMailer < ApplicationMailer class DomainMailer < ApplicationMailer
def registrant_pending_updated(domain) def pending_update_request_for_old_registrant(domain)
@domain = domain @domain = domain
return if delivery_off?(@domain) return if delivery_off?(@domain)
@ -20,16 +20,83 @@ class DomainMailer < ApplicationMailer
return if whitelist_blocked?(@old_registrant.email) return if whitelist_blocked?(@old_registrant.email)
mail(to: @old_registrant.email, mail(to: @old_registrant.email,
subject: "#{I18n.t(:domain_registrant_pending_updated_subject, name: @domain.name)} [#{@domain.name}]") subject: "#{I18n.t(:pending_update_request_for_old_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end end
def registrant_updated(domain) def pending_update_notification_for_new_registrant(domain)
@domain = domain
return if delivery_off?(@domain)
if @domain.registrant_verification_token.blank?
logger.warn "EMAIL NOT DELIVERED: registrant_verification_token is missing for #{@domain.name}"
return
end
if @domain.registrant_verification_asked_at.blank?
logger.warn "EMAIL NOT DELIVERED: registrant_verification_asked_at is missing for #{@domain.name}"
return
end
@new_registrant = @domain.registrant # NB! new registrant at this point
@old_registrant = Registrant.find(@domain.registrant_id_was)
return if whitelist_blocked?(@new_registrant.email)
mail(to: @new_registrant.email,
subject: "#{I18n.t(:pending_update_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
def registrant_updated_notification_for_new_registrant(domain)
@domain = domain @domain = domain
return if delivery_off?(@domain) return if delivery_off?(@domain)
return if whitelist_blocked?(@domain.registrant_email) return if whitelist_blocked?(@domain.registrant_email)
mail(to: @domain.registrant_email, mail(to: @domain.registrant_email,
subject: "#{I18n.t(:domain_registrant_updated, name: @domain.name)} [#{@domain.name}]") subject: "#{I18n.t(:registrant_updated_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
def registrant_updated_notification_for_old_registrant(domain)
@domain = domain
return if delivery_off?(@domain)
@old_registrant_email = domain.registrant_email # Nb! before applying pending updates
return if whitelist_blocked?(@old_registrant_email)
mail(to: @old_registrant_email,
subject: "#{I18n.t(:registrant_updated_notification_for_old_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
def pending_update_rejected_notification_for_new_registrant(domain)
@domain = domain
# no delivery off control, driggered by que, no epp request
@new_registrant_email = @domain.pending_json[:new_registrant_email]
@new_registrant_name = @domain.pending_json[:new_registrant_name]
return if whitelist_blocked?(@new_registrant_email)
mail(to: @new_registrant_email,
subject: "#{I18n.t(:pending_update_rejected_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
def pending_update_expired_notification_for_new_registrant(domain)
@domain = domain
# no delivery off control, driggered by cron, no epp request
@new_registrant_email = @domain.pending_json[:new_registrant_email]
@new_registrant_name = @domain.pending_json[:new_registrant_name]
return if whitelist_blocked?(@new_registrant_email)
if @new_registrant_email.blank?
logger.info "EMAIL NOT DELIVERED: no registrant email [pending_update_expired_notification_for_new_registrant]"
return
end
mail(to: @new_registrant_email,
subject: "#{I18n.t(:pending_update_expired_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end end
def pending_deleted(domain) def pending_deleted(domain)
@ -53,6 +120,46 @@ class DomainMailer < ApplicationMailer
return if whitelist_blocked?(@old_registrant.email) return if whitelist_blocked?(@old_registrant.email)
mail(to: @old_registrant.email, mail(to: @old_registrant.email,
subject: "#{I18n.t(:domain_pending_deleted_subject, name: @domain.name)} [#{@domain.name}]") subject: "#{I18n.t(:domain_pending_deleted_subject,
name: @domain.name)} [#{@domain.name}]")
end
def pending_delete_rejected_notification(domain)
@domain = domain
# no delivery off control, driggered by que, no epp request
if @domain.registrant_verification_token.blank?
logger.warn "EMAIL NOT DELIVERED: registrant_verification_token is missing for #{@domain.name}"
return
end
if @domain.registrant_verification_asked_at.blank?
logger.warn "EMAIL NOT DELIVERED: registrant_verification_asked_at is missing for #{@domain.name}"
return
end
return if whitelist_blocked?(@domain.registrant.email)
mail(to: @domain.registrant.email,
subject: "#{I18n.t(:pending_delete_rejected_notification_subject,
name: @domain.name)} [#{@domain.name}]")
end
def pending_delete_expired_notification(domain)
@domain = domain
# no delivery off control, driggered by cron, no epp request
return if whitelist_blocked?(@domain.registrant.email)
mail(to: @domain.registrant.email,
subject: "#{I18n.t(:pending_delete_expired_notification_subject,
name: @domain.name)} [#{@domain.name}]")
end
def delete_confirmation(domain)
@domain = domain
return if whitelist_blocked?(@domain.registrant.email)
mail(to: @domain.registrant.email,
subject: "#{I18n.t(:delete_confirmation_subject,
name: @domain.name)} [#{@domain.name}]")
end end
end end

View file

@ -16,6 +16,7 @@ class ApiUser < User
has_many :certificates has_many :certificates
validates :username, :password, :registrar, :roles, presence: true validates :username, :password, :registrar, :roles, presence: true
validates :password, length: { minimum: 6 }
validates :username, uniqueness: true validates :username, uniqueness: true
# TODO: probably cache, because it's requested on every EPP # TODO: probably cache, because it's requested on every EPP

View file

@ -20,17 +20,15 @@ module Versions
true true
end end
# needs refactoring
# TODO: optimization work
# belongs_to :api_creator, class_name: 'ApiUser', foreign_key: :creator_str
# belongs_to :creator, class_name: 'User', foreign_key: :creator_str
def creator def creator
return nil if creator_str.blank? return nil if creator_str.blank?
if creator_str =~ /^\d-api-/ if creator_str =~ /^\d+-AdminUser:/
creator = ApiUser.find_by(id: creator_str)
else
creator = AdminUser.find_by(id: creator_str) creator = AdminUser.find_by(id: creator_str)
elsif creator_str =~ /^\d+-ApiUser:/
creator = ApiUser.find_by(id: creator_str)
elsif creator_str =~ /^\d+-api-/ # depricated
creator = ApiUser.find_by(id: creator_str)
end end
creator.present? ? creator : creator_str creator.present? ? creator : creator_str
@ -39,10 +37,12 @@ module Versions
def updator def updator
return nil if updator_str.blank? return nil if updator_str.blank?
if updator_str =~ /^\d-api-/ if updator_str =~ /^\d+-AdminUser:/
updator = ApiUser.find_by(id: updator_str)
else
updator = AdminUser.find_by(id: updator_str) updator = AdminUser.find_by(id: updator_str)
elsif updator_str =~ /^\d+-ApiUser:/
updator = ApiUser.find_by(id: updator_str)
elsif updator_str =~ /^\d+-api-/ # depricated
updator = ApiUser.find_by(id: updator_str)
end end
updator.present? ? updator : updator_str updator.present? ? updator : updator_str

View file

@ -42,7 +42,14 @@ class Contact < ActiveRecord::Base
before_update :manage_emails before_update :manage_emails
def manage_emails def manage_emails
return nil unless email_changed? return nil unless email_changed?
ContactMailer.email_updated(self).deliver_now return nil unless deliver_emails == true
emails = []
emails << [email, email_was]
emails << domains.map(&:registrant_email) if domains.present?
emails = emails.flatten.uniq
emails.each do |e|
ContactMailer.email_updated(e, self).deliver_now
end
end end
before_save :manage_statuses before_save :manage_statuses
@ -51,6 +58,9 @@ class Contact < ActiveRecord::Base
manage_ok manage_ok
end end
# for overwrite when doing children loop
attr_writer :domains_present
scope :current_registrars, ->(id) { where(registrar_id: id) } scope :current_registrars, ->(id) { where(registrar_id: id) }
BIC = 'bic' BIC = 'bic'
@ -156,9 +166,19 @@ class Contact < ActiveRecord::Base
end end
def destroy_orphans def destroy_orphans
logger.info "#{Time.zone.now.utc} - Destroying orphaned contacts\n" STDOUT << "#{Time.zone.now.utc} - Destroying orphaned contacts\n" unless Rails.env.test?
count = find_orphans.destroy_all.count
logger.info "#{Time.zone.now.utc} - Successfully destroyed #{count} orphaned contacts\n" orphans = find_orphans
unless Rails.env.test?
orphans.each do |m|
STDOUT << "#{Time.zone.now.utc} Contact.destroy_orphans: ##{m.id}\n"
end
end
count = orphans.destroy_all.count
STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{count} orphaned contacts\n" unless Rails.env.test?
end end
def privs def privs
@ -260,21 +280,11 @@ class Contact < ActiveRecord::Base
Country.new(country_code) Country.new(country_code)
end end
# Find a way to use self.domains with contact
def domains_owned
Domain.where(registrant_id: id)
end
def relations_with_domain?
return true if domain_contacts.present? || domains_owned.present?
false
end
# TODO: refactor, it should not allow to destroy with normal destroy, # TODO: refactor, it should not allow to destroy with normal destroy,
# no need separate method # no need separate method
# should use only in transaction # should use only in transaction
def destroy_and_clean def destroy_and_clean
if relations_with_domain? if domains_present?
errors.add(:domains, :exist) errors.add(:domains, :exist)
return false return false
end end
@ -311,17 +321,32 @@ class Contact < ActiveRecord::Base
def status_notes_array=(notes) def status_notes_array=(notes)
self.status_notes = {} self.status_notes = {}
notes ||= [] notes ||= []
statuses.each_with_index do |status,i| statuses.each_with_index do |status, i|
self.status_notes[status] = notes[i] status_notes[status] = notes[i]
end end
end end
def manage_linked # optimization under children loop,
if domains.present? # otherwise bullet will not be happy
statuses << LINKED if statuses.detect { |s| s == LINKED }.blank? def domains_present?
else return @domains_present if @domains_present
statuses.delete_if { |s| s == LINKED } domain_contacts.present? || registrant_domains.present?
end end
def manage_linked
if domains_present?
set_linked
else
unset_linked
end
end
def set_linked
statuses << LINKED if statuses.detect { |s| s == LINKED }.blank?
end
def unset_linked
statuses.delete_if { |s| s == LINKED }
end end
# rubocop:disable Metrics/CyclomaticComplexity # rubocop:disable Metrics/CyclomaticComplexity

View file

@ -145,25 +145,26 @@ module Depp
end end
def save def save
create_xml = Depp::Contact.epp_xml.create( hash = {
{
id: { value: code }, id: { value: code },
email: { value: email },
voice: { value: phone },
postalInfo: { postalInfo: {
name: { value: name }, name: { value: name },
org: { value: org_name }, org: { value: org_name },
addr: { addr: {
street: { value: street }, street: { value: street },
city: { value: city }, city: { value: city },
pc: { value: zip },
sp: { value: state }, sp: { value: state },
pc: { value: zip },
cc: { value: country_code } cc: { value: country_code }
} }
}
}, },
extension_xml voice: { value: phone },
) email: { value: email }
}
hash[:id] = nil if code.blank?
create_xml = Depp::Contact.epp_xml.create(hash, extension_xml)
data = Depp::Contact.user.request(create_xml) data = Depp::Contact.user.request(create_xml)
self.id = data.css('id').text self.id = data.css('id').text
handle_errors(data) handle_errors(data)
@ -191,23 +192,23 @@ module Depp
{ {
id: { value: id }, id: { value: id },
chg: { chg: {
voice: { value: phone },
email: { value: email },
postalInfo: { postalInfo: {
name: { value: name }, name: { value: name },
org: { value: org_name }, org: { value: org_name },
addr: { addr: {
street: { value: street }, street: { value: street },
city: { value: city }, city: { value: city },
pc: { value: zip },
sp: { value: state }, sp: { value: state },
pc: { value: zip },
cc: { value: country_code } cc: { value: country_code }
} }
}
}, },
voice: { value: phone },
email: { value: email },
authInfo: { authInfo: {
pw: { value: password } pw: { value: password }
} }
}
}, },
extension_xml extension_xml
) )

View file

@ -36,15 +36,17 @@ module Depp
end end
def create(domain_params) def create(domain_params)
dns_hash = {}
keys = Domain.create_dnskeys_hash(domain_params)
dns_hash[:_anonymus] = keys if keys.any?
xml = epp_xml.create({ xml = epp_xml.create({
name: { value: domain_params[:name] }, name: { value: domain_params[:name] },
registrant: { value: domain_params[:registrant] },
period: { value: domain_params[:period].to_s[0], attrs: { unit: domain_params[:period].to_s[1] } }, period: { value: domain_params[:period].to_s[0], attrs: { unit: domain_params[:period].to_s[1] } },
ns: Domain.create_nameservers_hash(domain_params), ns: Domain.create_nameservers_hash(domain_params),
registrant: { value: domain_params[:registrant] },
_anonymus: Domain.create_contacts_hash(domain_params) _anonymus: Domain.create_contacts_hash(domain_params)
}, { }, dns_hash, Domain.construct_custom_params_hash(domain_params))
_anonymus: Domain.create_dnskeys_hash(domain_params)
}, Domain.construct_custom_params_hash(domain_params))
current_user.request(xml) current_user.request(xml)
end end
@ -198,6 +200,8 @@ module Depp
custom_params custom_params
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def construct_edit_hash(domain_params, old_domain_params) def construct_edit_hash(domain_params, old_domain_params)
contacts = array_difference(create_contacts_hash(domain_params), create_contacts_hash(old_domain_params)) contacts = array_difference(create_contacts_hash(domain_params), create_contacts_hash(old_domain_params))
add_anon = contacts add_anon = contacts
@ -205,29 +209,40 @@ module Depp
contacts = array_difference(create_contacts_hash(old_domain_params), create_contacts_hash(domain_params)) contacts = array_difference(create_contacts_hash(old_domain_params), create_contacts_hash(domain_params))
rem_anon = contacts rem_anon = contacts
add_arr = []
add_ns = create_nameservers_hash(domain_params) - create_nameservers_hash(old_domain_params)
add_arr << { ns: add_ns } if add_ns.any?
add_arr << { _anonymus: add_anon } if add_anon.any?
rem_arr = []
rem_ns = create_nameservers_hash(old_domain_params) - create_nameservers_hash(domain_params)
rem_arr << { ns: rem_ns } if rem_ns.any?
rem_arr << { _anonymus: rem_anon } if rem_anon.any?
if domain_params[:registrant] != old_domain_params[:registrant] if domain_params[:registrant] != old_domain_params[:registrant]
chg = [{ registrant: { value: domain_params[:registrant] } }] chg = [{ registrant: { value: domain_params[:registrant] } }]
end end
add_arr = nil if add_arr.none?
rem_arr = nil if rem_arr.none?
{ {
name: { value: domain_params[:name] }, name: { value: domain_params[:name] },
chg: chg, chg: chg,
add: [ add: add_arr,
{ ns: create_nameservers_hash(domain_params) - create_nameservers_hash(old_domain_params) }, rem: rem_arr
{ _anonymus: add_anon }
],
rem: [
{ ns: create_nameservers_hash(old_domain_params) - create_nameservers_hash(domain_params) },
{ _anonymus: rem_anon }
]
} }
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def construct_ext_edit_hash(domain_params, old_domain_params) def construct_ext_edit_hash(domain_params, old_domain_params)
{ rem_keys = create_dnskeys_hash(old_domain_params) - create_dnskeys_hash(domain_params)
add: create_dnskeys_hash(domain_params) - create_dnskeys_hash(old_domain_params), add_keys = create_dnskeys_hash(domain_params) - create_dnskeys_hash(old_domain_params)
rem: create_dnskeys_hash(old_domain_params) - create_dnskeys_hash(domain_params) hash = {}
} hash[:rem] = rem_keys if rem_keys.any?
hash[:add] = add_keys if add_keys.any?
hash
end end
def create_nameservers_hash(domain_params) def create_nameservers_hash(domain_params)

View file

@ -90,7 +90,8 @@ module Depp
server.close_connection server.close_connection
rescue OpenSSL::SSL::SSLError rescue OpenSSL::SSL::SSLError => e
Rails.logger.error "INVALID CERT: #{e}"
errors.add(:base, :invalid_cert) errors.add(:base, :invalid_cert)
end end
end end

View file

@ -5,7 +5,6 @@ class Domain < ActiveRecord::Base
# TODO: whois requests ip whitelist for full info for own domains and partial info for other domains # TODO: whois requests ip whitelist for full info for own domains and partial info for other domains
# TODO: most inputs should be trimmed before validatation, probably some global logic? # TODO: most inputs should be trimmed before validatation, probably some global logic?
paginates_per 10 # just for showoff
belongs_to :registrar belongs_to :registrar
belongs_to :registrant belongs_to :registrant
@ -63,21 +62,21 @@ class Domain < ActiveRecord::Base
before_create :generate_auth_info before_create :generate_auth_info
before_create :set_validity_dates before_create :set_validity_dates
before_create -> { self.reserved = in_reserved_list?; nil } before_create -> { self.reserved = in_reserved_list?; nil }
before_update :manage_statuses
def manage_statuses
return unless registrant_id_changed?
pending_update! if registrant_verification_asked?
true
end
before_save :manage_automatic_statuses before_save :manage_automatic_statuses
before_save :touch_always_version before_save :touch_always_version
def touch_always_version def touch_always_version
self.updated_at = Time.zone.now self.updated_at = Time.zone.now
end end
after_save :update_whois_record
before_update :manage_statuses
def manage_statuses
return unless registrant_id_changed? # rollback has not yet happened
pending_update! if registrant_verification_asked?
true
end
after_save :update_whois_record
after_create :update_reserved_domains after_create :update_reserved_domains
def update_reserved_domains def update_reserved_domains
@ -183,6 +182,9 @@ class Domain < ActiveRecord::Base
) )
end end
# rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
def clean_expired_pendings def clean_expired_pendings
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
@ -197,19 +199,32 @@ class Domain < ActiveRecord::Base
next next
end end
count += 1 count += 1
if domain.pending_update?
DomainMailer.pending_update_expired_notification_for_new_registrant(domain).deliver_now
end
if domain.pending_delete?
DomainMailer.pending_delete_expired_notification(domain).deliver_now
end
domain.clean_pendings! domain.clean_pendings!
STDOUT << "#{Time.zone.now.utc} Domain.clean_expired_pendings: ##{domain.id}\n" unless Rails.env.test?
end end
STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} domain pendings\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} domain pendings\n" unless Rails.env.test?
count count
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/LineLength
def start_expire_period def start_expire_period
STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test?
domains = Domain.where('valid_to <= ?', Time.zone.now) domains = Domain.where('valid_to <= ?', Time.zone.now)
domains.each do |domain| domains.each do |domain|
next unless domain.expirable? next unless domain.expirable?
domain.set_expired! domain.set_expired
STDOUT << "#{Time.zone.now.utc} Domain.start_expire_period: ##{domain.id} #{domain.changes}\n" unless Rails.env.test?
domain.save(validate: false)
end end
STDOUT << "#{Time.zone.now.utc} - Successfully expired #{domains.count} domains\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} - Successfully expired #{domains.count} domains\n" unless Rails.env.test?
@ -219,12 +234,11 @@ class Domain < ActiveRecord::Base
STDOUT << "#{Time.zone.now.utc} - Setting server_hold to domains\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} - Setting server_hold to domains\n" unless Rails.env.test?
d = Domain.where('outzone_at <= ?', Time.zone.now) d = Domain.where('outzone_at <= ?', Time.zone.now)
d.each do |x| d.each do |domain|
next unless x.server_holdable? next unless domain.server_holdable?
x.statuses << DomainStatus::SERVER_HOLD domain.statuses << DomainStatus::SERVER_HOLD
# TODO: This should be managed by automatic_statuses STDOUT << "#{Time.zone.now.utc} Domain.start_redemption_grace_period: ##{domain.id} #{domain.changes}\n" unless Rails.env.test?
x.statuses.delete(DomainStatus::OK) domain.save
x.save
end end
STDOUT << "#{Time.zone.now.utc} - Successfully set server_hold to #{d.count} domains\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} - Successfully set server_hold to #{d.count} domains\n" unless Rails.env.test?
@ -234,11 +248,11 @@ class Domain < ActiveRecord::Base
STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test?
d = Domain.where('delete_at <= ?', Time.zone.now) d = Domain.where('delete_at <= ?', Time.zone.now)
d.each do |x| d.each do |domain|
x.statuses << DomainStatus::DELETE_CANDIDATE if x.delete_candidateable? next unless domain.delete_candidateable?
# TODO: This should be managed by automatic_statuses domain.statuses << DomainStatus::DELETE_CANDIDATE
x.statuses.delete(DomainStatus::OK) STDOUT << "#{Time.zone.now.utc} Domain.start_delete_period: ##{domain.id} #{domain.changes}\n" unless Rails.env.test?
x.save domain.save
end end
return if Rails.env.test? return if Rails.env.test?
@ -252,17 +266,20 @@ class Domain < ActiveRecord::Base
c = 0 c = 0
Domain.where("statuses @> '{deleteCandidate}'::varchar[]").each do |x| Domain.where("statuses @> '{deleteCandidate}'::varchar[]").each do |x|
x.destroy x.destroy
STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: by deleteCandidate ##{x.id}\n" unless Rails.env.test?
c += 1 c += 1
end end
Domain.where('force_delete_at <= ?', Time.zone.now).each do |x| Domain.where('force_delete_at <= ?', Time.zone.now).each do |x|
x.destroy x.destroy
STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: by force delete time ##{x.id}\n" unless Rails.env.test?
c += 1 c += 1
end end
STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{c} domains\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{c} domains\n" unless Rails.env.test?
end end
# rubocop:enable Rails/FindEach # rubocop:enable Rails/FindEach
# rubocop: enable Metrics/LineLength
end end
def name=(value) def name=(value)
@ -337,10 +354,6 @@ class Domain < ActiveRecord::Base
save save
end end
def pending_update?
statuses.include?(DomainStatus::PENDING_UPDATE)
end
def pending_update! def pending_update!
return true if pending_update? return true if pending_update?
self.epp_pending_update = true # for epp self.epp_pending_update = true # for epp
@ -350,16 +363,29 @@ class Domain < ActiveRecord::Base
token = registrant_verification_token token = registrant_verification_token
asked_at = registrant_verification_asked_at asked_at = registrant_verification_asked_at
changes_cache = changes changes_cache = changes
new_registrant_id = registrant.id
new_registrant_email = registrant.email
new_registrant_name = registrant.name
DomainMailer.registrant_pending_updated(self).deliver_now DomainMailer.pending_update_request_for_old_registrant(self).deliver_now
DomainMailer.pending_update_notification_for_new_registrant(self).deliver_now
reload # revert back to original reload # revert back to original
self.pending_json = pending_json_cache self.pending_json = pending_json_cache
self.registrant_verification_token = token self.registrant_verification_token = token
self.registrant_verification_asked_at = asked_at self.registrant_verification_asked_at = asked_at
self.statuses = [DomainStatus::PENDING_UPDATE] set_pending_update
pending_json[:domain] = changes_cache pending_json[:domain] = changes_cache
pending_json[:new_registrant_id] = new_registrant_id
pending_json[:new_registrant_email] = new_registrant_email
pending_json[:new_registrant_name] = new_registrant_name
# This pending_update! method is triggered by before_update
# Note, all before_save callbacks are excecuted before before_update,
# thus automatic statuses has already excectued by this point
# and we need to trigger automatic statuses manually (second time).
manage_automatic_statuses
end end
# rubocop: disable Metrics/CyclomaticComplexity # rubocop: disable Metrics/CyclomaticComplexity
@ -399,16 +425,12 @@ class Domain < ActiveRecord::Base
self.registrant_verification_token = SecureRandom.hex(42) self.registrant_verification_token = SecureRandom.hex(42)
end end
def pending_delete?
statuses.include?(DomainStatus::PENDING_DELETE)
end
def pending_delete! def pending_delete!
return true if pending_delete? return true if pending_delete?
self.epp_pending_delete = true # for epp self.epp_pending_delete = true # for epp
return true unless registrant_verification_asked? return true unless registrant_verification_asked?
self.statuses = [DomainStatus::PENDING_DELETE] set_pending_delete
save(validate: false) # should check if this did succeed save(validate: false) # should check if this did succeed
DomainMailer.pending_deleted(self).deliver_now DomainMailer.pending_deleted(self).deliver_now
@ -547,6 +569,60 @@ class Domain < ActiveRecord::Base
save(validate: false) save(validate: false)
end end
def pending_update?
statuses.include?(DomainStatus::PENDING_UPDATE)
end
def update_prohibited?
pending_update_prohibited? && pending_delete_prohibited?
end
# TODO: Review the list and disallow epp calls
def pending_update_prohibited?
(statuses & [
DomainStatus::CLIENT_UPDATE_PROHIBITED,
DomainStatus::SERVER_UPDATE_PROHIBITED,
DomainStatus::PENDING_CREATE,
DomainStatus::PENDING_UPDATE,
DomainStatus::PENDING_DELETE,
DomainStatus::PENDING_RENEW,
DomainStatus::PENDING_TRANSFER
]).present?
end
def set_pending_update
if pending_update_prohibited?
logger.info "DOMAIN STATUS UPDATE ISSUE ##{id}: PENDING_UPDATE not allowed to set. [#{statuses}]"
return nil
end
statuses << DomainStatus::PENDING_UPDATE
end
def pending_delete?
statuses.include?(DomainStatus::PENDING_DELETE)
end
# TODO: Review the list and disallow epp calls
def pending_delete_prohibited?
(statuses & [
DomainStatus::CLIENT_DELETE_PROHIBITED,
DomainStatus::SERVER_DELETE_PROHIBITED,
DomainStatus::PENDING_CREATE,
DomainStatus::PENDING_UPDATE,
DomainStatus::PENDING_DELETE,
DomainStatus::PENDING_RENEW,
DomainStatus::PENDING_TRANSFER
]).present?
end
def set_pending_delete
if pending_delete_prohibited?
logger.info "DOMAIN STATUS UPDATE ISSUE ##{id}: PENDING_DELETE not allowed to set. [#{statuses}]"
return nil
end
statuses << DomainStatus::PENDING_DELETE
end
def manage_automatic_statuses def manage_automatic_statuses
# domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if delete_candidateable? # domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if delete_candidateable?
if statuses.empty? && valid? if statuses.empty? && valid?

View file

@ -4,22 +4,32 @@ class Epp::Domain < Domain
before_validation :manage_permissions before_validation :manage_permissions
def manage_permissions def manage_permissions
return unless pending_update? || pending_delete? return unless update_prohibited?
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation)) add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
false false
end end
before_validation :validate_contacts before_validation :validate_contacts
def validate_contacts def validate_contacts
return if contacts.map {|c| c.valid? }.all? return if contacts.map(&:valid?).all?
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation)) add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
false false
end end
before_save :update_contact_status before_save :link_contacts
def update_contact_status def link_contacts
# Based on bullet report
unlinked_contacts = contacts.select { |c| !c.linked? } # speed up a bit
unlinked_contacts.each do |uc|
uc.domains_present = true # no need to fetch domains again
uc.save(validate: false)
end
end
after_destroy :unlink_contacts
def unlink_contacts
contacts.each do |c| contacts.each do |c|
next if c.linked? c.domains_present = false
c.save(validate: false) c.save(validate: false)
end end
end end
@ -94,6 +104,9 @@ class Epp::Domain < Domain
[:base, :key_data_not_allowed], [:base, :key_data_not_allowed],
[:period, :not_a_number], [:period, :not_a_number],
[:period, :not_an_integer] [:period, :not_an_integer]
],
'2308' => [
[:base, :domain_name_blocked, { value: { obj: 'name', val: name_dirty } }]
] ]
} }
end end
@ -134,7 +147,6 @@ class Epp::Domain < Domain
at[:reserved_pw] = frame.css('reserved > pw').text at[:reserved_pw] = frame.css('reserved > pw').text
# at[:statuses] = domain_statuses_attrs(frame, action) # at[:statuses] = domain_statuses_attrs(frame, action)
# binding.pry
at[:nameservers_attributes] = nameservers_attrs(frame, action) at[:nameservers_attributes] = nameservers_attrs(frame, action)
at[:admin_domain_contacts_attributes] = admin_domain_contacts_attrs(frame, action) at[:admin_domain_contacts_attributes] = admin_domain_contacts_attrs(frame, action)
at[:tech_domain_contacts_attributes] = tech_domain_contacts_attrs(frame, action) at[:tech_domain_contacts_attributes] = tech_domain_contacts_attrs(frame, action)
@ -383,6 +395,7 @@ class Epp::Domain < Domain
end end
# rubocop: disable Metrics/AbcSize # rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/CyclomaticComplexity
def update(frame, current_user, verify = true) def update(frame, current_user, verify = true)
return super if frame.blank? return super if frame.blank?
at = {}.with_indifferent_access at = {}.with_indifferent_access
@ -399,15 +412,20 @@ class Epp::Domain < Domain
# at[:statuses] += at_add[:domain_statuses_attributes] # at[:statuses] += at_add[:domain_statuses_attributes]
if verify && frame.css('registrant').present? && frame.css('registrant').attr('verified').to_s.downcase != 'yes' if verify &&
Setting.request_confrimation_on_registrant_change_enabled &&
frame.css('registrant').present? &&
frame.css('registrant').attr('verified').to_s.downcase != 'yes'
registrant_verification_asked!(frame.to_s, current_user.id) registrant_verification_asked!(frame.to_s, current_user.id)
end end
self.deliver_emails = true # turn on email delivery for epp self.deliver_emails = true # turn on email delivery for epp
errors.empty? && super(at) errors.empty? && super(at)
end end
# rubocop: enable Metrics/AbcSize # rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/CyclomaticComplexity
def apply_pending_update! def apply_pending_update!
old_registrant_email = DomainMailer.registrant_updated_notification_for_old_registrant(self)
preclean_pendings preclean_pendings
user = ApiUser.find(pending_json['current_user_id']) user = ApiUser.find(pending_json['current_user_id'])
frame = Nokogiri::XML(pending_json['frame']) frame = Nokogiri::XML(pending_json['frame'])
@ -416,7 +434,8 @@ class Epp::Domain < Domain
return unless update(frame, user, false) return unless update(frame, user, false)
clean_pendings! clean_pendings!
self.deliver_emails = true # turn on email delivery for epp self.deliver_emails = true # turn on email delivery for epp
DomainMailer.registrant_updated(self).deliver_now DomainMailer.registrant_updated_notification_for_new_registrant(self).deliver_now
old_registrant_email.deliver_now
end end
def apply_pending_delete! def apply_pending_delete!
@ -424,6 +443,7 @@ class Epp::Domain < Domain
user = ApiUser.find(pending_json['current_user_id']) user = ApiUser.find(pending_json['current_user_id'])
frame = Nokogiri::XML(pending_json['frame']) frame = Nokogiri::XML(pending_json['frame'])
statuses.delete(DomainStatus::PENDING_DELETE) statuses.delete(DomainStatus::PENDING_DELETE)
DomainMailer.delete_confirmation(self).deliver_now
clean_pendings! if epp_destroy(frame, user, false) clean_pendings! if epp_destroy(frame, user, false)
end end
@ -440,7 +460,10 @@ class Epp::Domain < Domain
def epp_destroy(frame, user_id, verify = true) def epp_destroy(frame, user_id, verify = true)
return false unless valid? return false unless valid?
if verify && frame.css('delete').attr('verified').to_s.downcase != 'yes' if verify &&
Setting.request_confirmation_on_domain_deletion_enabled &&
frame.css('delete').attr('verified').to_s.downcase != 'yes'
registrant_verification_asked!(frame.to_s, user_id) registrant_verification_asked!(frame.to_s, user_id)
self.deliver_emails = true # turn on email delivery for epp self.deliver_emails = true # turn on email delivery for epp
pending_delete! pending_delete!
@ -519,7 +542,7 @@ class Epp::Domain < Domain
return if registrant.registrar_id == registrar_id return if registrant.registrar_id == registrar_id
is_other_domains_contact = DomainContact.where('contact_id = ? AND domain_id != ?', registrant_id, id).count > 0 is_other_domains_contact = DomainContact.where('contact_id = ? AND domain_id != ?', registrant_id, id).count > 0
if registrant.domains_owned.count > 1 || is_other_domains_contact if registrant.registrant_domains.count > 1 || is_other_domains_contact
oc = copy_and_transfer_contact(registrant_id, registrar_id) oc = copy_and_transfer_contact(registrant_id, registrar_id)
self.registrant_id = oc.id self.registrant_id = oc.id
else else

View file

@ -29,7 +29,7 @@ class Invoice < ActiveRecord::Base
return if number <= Setting.invoice_number_max.to_i return if number <= Setting.invoice_number_max.to_i
errors.add(:base, I18n.t('failed_to_generate_invoice')) errors.add(:base, I18n.t('failed_to_generate_invoice_invoice_number_limit_reached'))
logger.error('INVOICE NUMBER LIMIT REACHED, COULD NOT GENERATE INVOICE') logger.error('INVOICE NUMBER LIMIT REACHED, COULD NOT GENERATE INVOICE')
false false
end end
@ -45,6 +45,12 @@ class Invoice < ActiveRecord::Base
'due_date < ? AND cancelled_at IS NULL', cr_at 'due_date < ? AND cancelled_at IS NULL', cr_at
) )
unless Rails.env.test?
invoices.each do |m|
STDOUT << "#{Time.zone.now.utc} Invoice.cancel_overdue_invoices: ##{m.id}\n"
end
end
count = invoices.update_all(cancelled_at: Time.zone.now) count = invoices.update_all(cancelled_at: Time.zone.now)
STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} overdue invoices\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} overdue invoices\n" unless Rails.env.test?

View file

@ -1,7 +1,12 @@
class Pricelist < ActiveRecord::Base class Pricelist < ActiveRecord::Base
include Versions # version/pricelist_version.rb include Versions # version/pricelist_version.rb
scope :valid, -> { where("valid_from <= ? AND valid_to >= ? OR valid_to IS NULL", Time.zone.now, Time.zone.now) } scope :valid, lambda {
where(
"valid_from <= ? AND valid_to >= ? OR valid_to IS NULL",
Time.zone.now.end_of_day, Time.zone.now.beginning_of_day
)
}
monetize :price_cents monetize :price_cents

View file

@ -72,10 +72,11 @@ class Registrar < ActiveRecord::Base
end end
# rubocop:disable Metrics/MethodLength # rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def issue_prepayment_invoice(amount, description = nil) def issue_prepayment_invoice(amount, description = nil)
invoices.create( invoices.create(
invoice_type: 'DEB', invoice_type: 'DEB',
due_date: Time.zone.now.to_date + 1.day, due_date: (Time.zone.now.to_date + Setting.days_to_keep_invoices_active.days).end_of_day,
payment_term: 'prepayment', payment_term: 'prepayment',
description: description, description: description,
currency: 'EUR', currency: 'EUR',
@ -117,6 +118,7 @@ class Registrar < ActiveRecord::Base
] ]
) )
end end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength # rubocop:enable Metrics/MethodLength
def cash_account def cash_account

View file

@ -3,7 +3,7 @@ class DomainNameValidator < ActiveModel::EachValidator
if !self.class.validate_format(value) if !self.class.validate_format(value)
record.errors[attribute] << (options[:message] || record.errors.generate_message(attribute, :invalid)) record.errors[attribute] << (options[:message] || record.errors.generate_message(attribute, :invalid))
elsif !self.class.validate_blocked(value) elsif !self.class.validate_blocked(value)
record.errors.add(attribute, (options[:message] || record.errors.generate_message(attribute, :blocked))) record.errors.add(:base, :domain_name_blocked)
end end
end end

View file

@ -8,7 +8,7 @@
%th{class: 'col-xs-4'}= t(:registrar) %th{class: 'col-xs-4'}= t(:registrar)
%th{class: 'col-xs-4'}= t(:valid_to) %th{class: 'col-xs-4'}= t(:valid_to)
%tbody %tbody
- @contact.domains_owned.each do |x| - @contact.registrant_domains.each do |x|
%tr %tr
%td= link_to(x.name, [:admin, x]) %td= link_to(x.name, [:admin, x])
%td= link_to(x.registrar, [:admin, x.registrar]) %td= link_to(x.registrar, [:admin, x.registrar])

View file

@ -2,16 +2,53 @@
.row .row
.col-md-12 .col-md-12
= search_form_for [:admin, @q], html: { class: 'form-horizontal' } do |f| = search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
.col-md-11 .row
.col-md-3
.form-group .form-group
= f.search_field :name_cont, class: 'form-control' = f.label :name
.col-md-1.text-right.text-center-xs = f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name)
.col-md-3
.form-group .form-group
= f.label t(:registrant_ident)
= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident)
.col-md-3
.form-group
= f.label t(:contact_ident)
= f.search_field :contacts_ident_eq, class: 'form-control', placeholder: t(:contact_ident)
.col-md-3
.form-group
= f.label t(:nameserver_hostname)
= f.search_field :nameservers_hostname_eq, class: 'form-control', placeholder: t(:nameserver_hostname)
.row
.col-md-6
.form-group
= f.label t(:registrar)
= f.select :registrar_id_eq, Registrar.all.map { |x| [x, x.id] }, { include_blank: true }, class: 'form-control selectize', placeholder: t(:choose)
.col-md-3
.form-group
= f.label t(:valid_to_from)
= f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq], class: 'form-control datepicker', placeholder: t(:valid_to_from)
.col-md-3
.form-group
= f.label t(:valid_to_until)
= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq], class: 'form-control datepicker', placeholder: t(:valid_to_until)
.row
.col-md-6
.form-group
= label_tag t(:status)
= select_tag :statuses_contains, options_for_select(DomainStatus::STATUSES, params[:statuses_contains]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' }
.col-md-3
.form-group
= label_tag t(:results_per_page)
= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page)
.col-md-3{style: 'padding-top: 25px;'}
%button.btn.btn-primary %button.btn.btn-primary
&nbsp; &nbsp;
%span.glyphicon.glyphicon-search %span.glyphicon.glyphicon-search
&nbsp; &nbsp;
%button.btn.btn-default.js-reset-form
= t(:clear_fields)
%hr %hr
.row .row
.col-md-12 .col-md-12
@ -38,5 +75,13 @@
%td= l(x.valid_to, format: :short) %td= l(x.valid_to, format: :short)
%td= link_to(x.registrar, admin_registrar_path(x.registrar)) if x.registrar %td= link_to(x.registrar, admin_registrar_path(x.registrar)) if x.registrar
.row .row
.col-md-12 .col-md-6
= paginate @domains = paginate @domains
.col-md-6.text-right
.pagination
= t(:result_count, count: @domains.total_count)
:coffee
$(".js-reset-form").on "click", (e) ->
e.preventDefault();
window.location = "#{admin_domains_path}"

View file

@ -31,7 +31,7 @@
%dd= @epp_log.created_at %dd= @epp_log.created_at
.row .row
.col-md-6 .col-md-12
.panel.panel-default .panel.panel-default
.panel-heading .panel-heading
%h3.panel-title= t(:request) %h3.panel-title= t(:request)
@ -43,7 +43,8 @@
= formatted_req = formatted_req
- else - else
= @epp_log.request = @epp_log.request
.col-md-6 .row
.col-md-12
.panel.panel-default .panel.panel-default
.panel-heading .panel-heading
%h3.panel-title= t(:response) %h3.panel-title= t(:response)

View file

@ -1,7 +1,6 @@
- content_for :actions do - content_for :actions do
= link_to(t(:add), new_admin_invoice_path, class: 'btn btn-primary') = link_to(t(:add), new_admin_invoice_path, class: 'btn btn-primary')
= render 'shared/title', name: t(:invoices) = render 'shared/title', name: t(:invoices)
.row .row
.col-md-12 .col-md-12
.table-responsive .table-responsive
@ -24,10 +23,10 @@
- if x.cancelled? - if x.cancelled?
%td.text-grey= t(:cancelled) %td.text-grey= t(:cancelled)
- else - else
%td= l(x.due_date) %td= l(x.due_date, format: :date_long)
- if x.binded? - if x.binded?
%td= l(x.receipt_date) %td= l(x.receipt_date, format: :date_long)
- elsif x.cancelled? - elsif x.cancelled?
%td.text-grey= t(:cancelled) %td.text-grey= t(:cancelled)
- else - else

View file

@ -4,7 +4,8 @@
= form_for([:admin, @deposit], url: admin_invoices_path, method: :post, html: { class: 'form-horizontal' }) do |f| = form_for([:admin, @deposit], url: admin_invoices_path, method: :post, html: { class: 'form-horizontal' }) do |f|
= render 'shared/full_errors', object: @deposit = render 'shared/full_errors', object: @deposit
- if @invoice
= render 'shared/full_errors', object: @invoice
.row .row
.col-md-8 .col-md-8
.form-group .form-group

View file

@ -2,5 +2,13 @@
.col-sm-6 .col-sm-6
%h2.text-center-xs= "#{t(:edit)}: #{@pricelist.name}" %h2.text-center-xs= "#{t(:edit)}: #{@pricelist.name}"
- if @pricelist.persisted? && @pricelist.errors.none?
%hr
- active_pricelist = Pricelist.pricelist_for(@pricelist.category, @pricelist.operation_category, @pricelist.duration)
- if active_pricelist
= t('active_price_for_this_operation_is', price: "#{active_pricelist.price.amount.to_s} #{active_pricelist.price_currency}")
- else
= t('active_price_missing_for_this_operation')
%hr %hr
= render 'form' = render 'form'

View file

@ -14,10 +14,10 @@
%tr %tr
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= sort_link(@q, 'category', t(:category)) = sort_link(@q, 'category', t(:category))
%th{class: 'col-xs-2'}
= sort_link(@q, 'operation_category', t(:operation))
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= sort_link(@q, 'duration', t(:duration)) = sort_link(@q, 'duration', t(:duration))
%th{class: 'col-xs-2'}
= sort_link(@q, 'operation_category', t(:operation))
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= sort_link(@q, 'price', t(:price)) = sort_link(@q, 'price', t(:price))
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
@ -31,8 +31,8 @@
- @pricelists.each do |pricelist| - @pricelists.each do |pricelist|
%tr %tr
%td= pricelist.category %td= pricelist.category
%td= pricelist.operation_category
%td= pricelist.duration %td= pricelist.duration
%td= pricelist.operation_category
%td= pricelist.price %td= pricelist.price
%td= l(pricelist.valid_from, format: :ydate) %td= l(pricelist.valid_from, format: :ydate)
%td= l(pricelist.valid_to, format: :ydate) %td= l(pricelist.valid_to, format: :ydate)

View file

@ -52,6 +52,8 @@
= render 'setting_row', var: :client_side_status_editing_enabled = render 'setting_row', var: :client_side_status_editing_enabled
= render 'setting_row', var: :api_ip_whitelist_enabled = render 'setting_row', var: :api_ip_whitelist_enabled
= render 'setting_row', var: :registrar_ip_whitelist_enabled = render 'setting_row', var: :registrar_ip_whitelist_enabled
= render 'setting_row', var: :request_confrimation_on_registrant_change_enabled
= render 'setting_row', var: :request_confirmation_on_domain_deletion_enabled
.panel.panel-default .panel.panel-default
.panel-heading.clearfix .panel-heading.clearfix
@ -65,6 +67,7 @@
%tbody %tbody
= render 'setting_row', var: :invoice_number_min = render 'setting_row', var: :invoice_number_min
= render 'setting_row', var: :invoice_number_max = render 'setting_row', var: :invoice_number_max
= render 'setting_row', var: :days_to_keep_invoices_active
= render 'setting_row', var: :days_to_keep_overdue_invoices_active = render 'setting_row', var: :days_to_keep_overdue_invoices_active
= render 'setting_row', var: :registry_billing_email = render 'setting_row', var: :registry_billing_email
= render 'setting_row', var: :registry_invoice_contact = render 'setting_row', var: :registry_invoice_contact

View file

@ -5,7 +5,7 @@ xml.epp_head do
end end
xml.resData do xml.resData do
xml.tag!('contact:chkData', 'xmlns:contact' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd') do xml.tag!('contact:chkData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-eis-1.0.xsd') do
@results.each do |result| @results.each do |result|
xml.tag!('contact:cd') do xml.tag!('contact:cd') do
xml.tag! "contact:id", result[:code], avail: result[:avail] xml.tag! "contact:id", result[:code], avail: result[:avail]

View file

@ -5,7 +5,7 @@ xml.epp_head do
end end
xml.resData do xml.resData do
xml.tag!('contact:creData', 'xmlns:contact' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd') do xml.tag!('contact:creData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-eis-1.0.xsd') do
xml.tag!('contact:id', @contact.code) xml.tag!('contact:id', @contact.code)
xml.tag!('contact:crDate', @contact.created_at.try(:iso8601)) xml.tag!('contact:crDate', @contact.created_at.try(:iso8601))
end end

View file

@ -5,7 +5,7 @@ xml.epp_head do
end end
xml.resData do xml.resData do
xml.tag!('contact:infData', 'xmlns:contact' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd') do xml.tag!('contact:infData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-eis-1.0.xsd') do
xml.tag!('contact:id', @contact.code) xml.tag!('contact:id', @contact.code)
xml.tag!('contact:roid', @contact.roid) xml.tag!('contact:roid', @contact.roid)
@ -55,7 +55,7 @@ xml.epp_head do
end end
if can? :view_full_info, @contact, @password if can? :view_full_info, @contact, @password
xml.tag!('extension') do xml.tag!('extension') do
xml.tag!('eis:extdata', 'xmlns:eis' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/eis-1.0.xsd') do xml.tag!('eis:extdata', 'xmlns:eis' => 'https://epp.tld.ee/schema/eis-1.0.xsd') do
xml.tag!('eis:ident', @contact.ident, xml.tag!('eis:ident', @contact.ident,
type: @contact.ident_type, cc: @contact.ident_country_code) type: @contact.ident_type, cc: @contact.ident_country_code)
end end

View file

@ -5,7 +5,7 @@ xml.epp_head do
end end
xml.resData do xml.resData do
xml.tag!('contact:creData', 'xmlns:contact' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd') do xml.tag!('contact:creData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-eis-1.0.xsd') do
xml.tag!('contact:id', @contact.code) xml.tag!('contact:id', @contact.code)
xml.tag!('contact:crDate', @contact.created_at.try(:iso8601)) xml.tag!('contact:crDate', @contact.created_at.try(:iso8601))
end end

View file

@ -5,7 +5,7 @@ xml.epp_head do
end end
xml.resData do xml.resData do
xml.tag!('domain:chkData', 'xmlns:domain' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd') do xml.tag!('domain:chkData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') do
@domains.each do |x| @domains.each do |x|
xml.tag!('domain:cd') do xml.tag!('domain:cd') do
xml.tag!('domain:name', x[:name], 'avail' => x[:avail]) xml.tag!('domain:name', x[:name], 'avail' => x[:avail])

View file

@ -5,7 +5,7 @@ xml.epp_head do
end end
xml.resData do xml.resData do
xml.tag!('domain:creData', 'xmlns:domain' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd') do xml.tag!('domain:creData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') do
xml.tag!('domain:name', @domain.name) xml.tag!('domain:name', @domain.name)
xml.tag!('domain:crDate', @domain.created_at.try(:iso8601)) xml.tag!('domain:crDate', @domain.created_at.try(:iso8601))
xml.tag!('domain:exDate', @domain.valid_to.try(:iso8601)) xml.tag!('domain:exDate', @domain.valid_to.try(:iso8601))

View file

@ -5,7 +5,7 @@ xml.epp_head do
end end
xml.resData do xml.resData do
xml.tag!('domain:infData', 'xmlns:domain' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd') do xml.tag!('domain:infData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') do
xml.tag!('domain:name', @domain.name) xml.tag!('domain:name', @domain.name)
xml.tag!('domain:roid', @domain.roid) xml.tag!('domain:roid', @domain.roid)
@domain.statuses.each do |s| @domain.statuses.each do |s|

View file

@ -1,4 +1,4 @@
builder.tag!('domain:trnData', 'xmlns:domain' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd') do builder.tag!('domain:trnData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') do
builder.tag!('domain:name', dt.domain_name) builder.tag!('domain:name', dt.domain_name)
builder.tag!('domain:trStatus', dt.status) builder.tag!('domain:trStatus', dt.status)
builder.tag!('domain:reID', dt.transfer_to.code) builder.tag!('domain:reID', dt.transfer_to.code)

View file

@ -5,7 +5,7 @@ xml.epp_head do
end end
xml.resData do xml.resData do
xml.tag!('domain:renData', 'xmlns:domain' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd') do xml.tag!('domain:renData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') do
xml.tag!('domain:name', @domain[:name]) xml.tag!('domain:name', @domain[:name])
xml.tag!('domain:exDate', @domain.valid_to.try(:iso8601)) xml.tag!('domain:exDate', @domain.valid_to.try(:iso8601))
end end

View file

@ -2,7 +2,7 @@ xml.instruct!(:xml, standalone: 'no')
xml.epp( xml.epp(
'xmlns' => 'urn:ietf:params:xml:ns:epp-1.0', 'xmlns' => 'urn:ietf:params:xml:ns:epp-1.0',
'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1', 'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1',
'xmlns:domain' => 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd',
'xmlns:keyrelay' => 'urn:ietf:params:xml:ns:keyrelay-1.0' 'xmlns:keyrelay' => 'urn:ietf:params:xml:ns:keyrelay-1.0'
) do ) do
xml.response do xml.response do

View file

@ -5,13 +5,13 @@ xml.epp_head do
xml.svcMenu do xml.svcMenu do
xml.version '1.0' xml.version '1.0'
xml.lang 'en' xml.lang 'en'
xml.objURI 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd' xml.objURI 'https://epp.tld.ee/schema/domain-eis-1.0.xsd'
xml.objURI 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd' xml.objURI 'https://epp.tld.ee/schema/contact-eis-1.0.xsd'
xml.objURI 'urn:ietf:params:xml:ns:host-1.0' xml.objURI 'urn:ietf:params:xml:ns:host-1.0'
xml.objURI 'urn:ietf:params:xml:ns:keyrelay-1.0' xml.objURI 'urn:ietf:params:xml:ns:keyrelay-1.0'
xml.svcExtension do xml.svcExtension do
xml.extURI 'urn:ietf:params:xml:ns:secDNS-1.1' xml.extURI 'urn:ietf:params:xml:ns:secDNS-1.1'
xml.extURI 'https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/eis-1.0.xsd' xml.extURI 'https://epp.tld.ee/schema/eis-1.0.xsd'
end end
end end

View file

@ -49,8 +49,15 @@
%li{class: active_class}= link_to t(:xml_console), registrar_xml_console_path %li{class: active_class}= link_to t(:xml_console), registrar_xml_console_path
%ul.nav.navbar-nav.navbar-right %ul.nav.navbar-nav.navbar-right
%li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
= "#{current_user} (#{current_user.roles.first}) - #{current_user.registrar}"
%span.caret
%ul.dropdown-menu{role: "menu"}
- ApiUser.where(identity_code: current_user.identity_code).includes(:registrar).each do |x|
%li= link_to "#{x} (#{x.roles.first}) - #{x.registrar}", "/registrar/switch_user/#{x.id}"
- if user_signed_in? - if user_signed_in?
%li= link_to t(:log_out, user: current_user), '/registrar/logout' %li= link_to t(:log_out_), '/registrar/logout'
.container .container
= render 'shared/flash' = render 'shared/flash'

View file

@ -29,9 +29,9 @@ Eesti Interneti SA
<br><br> <br><br>
Hi <%= @contact.name %> Hi <%= @contact.name %>
<br><br> <br><br>
E-mail address of <% @contact.name %> has been changed<br> E-mail address of <%= @contact.name %> has been changed<br>
previous address: <% @contact.email_was %><br> previous address: <%= @contact.email_was %><br>
new address: <% @contact.email %> new address: <%= @contact.email %>
<br><br> <br><br>
E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct. Incase of problems please turn to your registrar. Your registrar is <%= @contact.registrar.name %> E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct. Incase of problems please turn to your registrar. Your registrar is <%= @contact.registrar.name %>
<br><br> <br><br>

View file

@ -29,9 +29,9 @@ Eesti Interneti SA
Hi <%= @contact.name %> Hi <%= @contact.name %>
E-mail address of <% @contact.name %> has been changed E-mail address of <%= @contact.name %> has been changed
previous address: <% @contact.email_was %> previous address: <%= @contact.email_was %>
new address: <% @contact.email %> new address: <%= @contact.email %>
E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct. Incase of problems please turn to your registrar. Your registrar is <%= @contact.registrar.name %> E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct. Incase of problems please turn to your registrar. Your registrar is <%= @contact.registrar.name %>

View file

@ -0,0 +1,15 @@
Tere,
<br><br>
Domeeni <%= @domain.name %> kustutamise taotlus on registreerija poolt kinnitatud. Domeen <%= @domain.name %> on peatatud ja kustub registrist.
<br><br>
Lugupidamisega<br>
Eesti Interneti SA
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Domain <%= @domain.name %> deletion confirmed and will be deleted.
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -0,0 +1,15 @@
Tere,
Domeeni <%= @domain.name %> kustutamise taotlus on registreerija poolt kinnitatud. Domeen <%= @domain.name %> on peatatud ja kustub registrist.
Lugupidamisega
Eesti Interneti SA
--------------------------------------
Hi,
Domain <%= @domain.name %> deletion confirmed and will be deleted.
Best Regards,
Estonian Internet Foundation

View file

@ -0,0 +1,15 @@
Tere,
<br><br>
Domeeni <%= @domain.name %> kustutamise taotlust ei kinnitatud tähtaegselt registreerija <%= @domain.registrant_name %> poolt. Domeeni <%= @domain.name %> kustutamine on sellest tulenevalt tühistatud.
<br><br>
Lugupidamisega<br>
Eesti Interneti SA
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Domain <%= @domain.name %> deletion cancelled.
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -0,0 +1,15 @@
Tere,
Domeeni <%= @domain.name %> kustutamise taotlust ei kinnitatud tähtaegselt registreerija <%= @domain.registrant_name %> poolt. Domeeni <%= @domain.name %> kustutamine on sellest tulenevalt tühistatud.
Lugupidamisega
Eesti Interneti SA
--------------------------------------
Hi,
Domain <%= @domain.name %> deletion cancelled.
Best Regards,
Estonian Internet Foundation

View file

@ -0,0 +1,15 @@
Tere,
<br><br>
Domeeni <%= @domain.name %> kustutamise taotlus on registreerija <%= @domain.registrar_name %> poolt tagasi lükatud.
<br><br>
Lugupidamisega<br>
Eesti Interneti SA
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Domain <%= @domain.name %> deletion rejected.
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -0,0 +1,15 @@
Tere,
Domeeni <%= @domain.name %> kustutamise taotlus on registreerija <%= @domain.registrar_name %> poolt tagasi lükatud.
Lugupidamisega
Eesti Interneti SA
--------------------------------------
Hi,
Domain <%= @domain.name %> deletion rejected.
Best Regards,
Estonian Internet Foundation

View file

@ -0,0 +1,19 @@
Tere,
<br><br>
Domeeni <%= @domain.name %> registreerija <%= @domain.registrant_name %> ei kinnitanud tähtaegselt registreerija vahetuse taotlust. Domeeni <%= @domain.name %> registreerija vahetus on sellest tulenevalt tühistatud.
<br><br>
Küsimuste korral palun võtke ühendust registripidajaga <%= @domain.registrar_name %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad
<br><br>
Lugupidamisega<br>
Eesti Interneti SA
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Domain registrant change has been expired for the domain <%= @domain.name %>.
<br><br>
Please contact to your registrar <%= @domain.registrar_name %> if you have any questions.
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -0,0 +1,19 @@
Tere,
Domeeni <%= @domain.name %> registreerija <%= @domain.registrant_name %> ei kinnitanud tähtaegselt registreerija vahetuse taotlust. Domeeni <%= @domain.name %> registreerija vahetus on sellest tulenevalt tühistatud.
Küsimuste korral palun võtke ühendust registripidajaga <%= @domain.registrar_name %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad
Lugupidamisega
Eesti Interneti SA
--------------------------------------
Hi,
Domain registrant change has been expired for the domain <%= @domain.name %>.
Please contact to your registrar <%= @domain.registrar_name %> if you have any questions.
Best Regards,
Estonian Internet Foundation

View file

@ -0,0 +1,47 @@
Tere,
<br><br>
Registripidaja <%= @domain.registrar_name %> vahendusel on algatatud <%= @domain.name %> domeeni omanikuvahetuse protseduur.
<br><br>
Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @domain.registrar_name %>
<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 %>
Tänav: <%= @domain.registrant_street %><br>
Linn: <%= @domain.registrant_city %><br>
Riik: <%= @domain.registrant_country %>
<br><br>
Juhime Teie tähelepanu asjaolule, et omanikuvahetuse protseduur viiaks lõpule vaid juhul, kui domeeni hetkel kehtiv registreerija <%= @old_registrant.name %> omanikuvahetuse tähtaegselt kinnitab.
<br><br>
Juhul kui <%= @old_registrant.name %> lükkab omanikuvahtuse taotluse tagasi või ei anna kinnitust enne <%= Setting.expire_pending_confirmation %> tundi, omanikuvahetuse protseduur tühistatakse.
<br><br>
Küsimuste korral palun võtke ühendust registripidajaga <%= @domain.registrar_name %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad
<br><br>
Lugupidamisega<br>
Eesti Interneti SA
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Registrant change process for the domain <%= @domain.name %> has been started.
<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 %>
Street: <%= @domain.registrant_street %><br>
City: <%= @domain.registrant_city %><br>
Country: <%= @domain.registrant_country %>
<br><br>
Please contact to your registrar <%= @domain.registrar_name %> if you have any questions.
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -0,0 +1,47 @@
Tere,
Registripidaja <%= @domain.registrar_name %> vahendusel on algatatud <%= @domain.name %> domeeni omanikuvahetuse protseduur.
Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @domain.registrar_name %>
Uued registreerija andmed:
Nimi: <%= @domain.registrant_name %>
<% if @domain.registrant.priv? %>
Isikukood: <%= @domain.registrant_ident %>
<% else %>
Äriregistrikood: <%= @domain.registrant_ident %>
<% end %>
Tänav: <%= @domain.registrant_street %>
Linn: <%= @domain.registrant_city %>
Riik: <%= @domain.registrant_country %>
Juhime Teie tähelepanu asjaolule, et omanikuvahetuse protseduur viiaks lõpule vaid juhul, kui domeeni hetkel kehtiv registreerija <%= @old_registrant.name %> omanikuvahetuse tähtaegselt kinnitab.
Juhul kui <%= @old_registrant.name %> lükkab omanikuvahtuse taotluse tagasi või ei anna kinnitust enne <%= Setting.expire_pending_confirmation %> tundi, omanikuvahetuse protseduur tühistatakse.
Küsimuste korral palun võtke ühendust registripidajaga <%= @domain.registrar_name %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad
Lugupidamisega
Eesti Interneti SA
--------------------------------------
Hi,
Registrant change process for the domain <%= @domain.name %> has been started.
New registrant:
Name: <%= @domain.registrant_name %>
<% if @domain.registrant.priv? %>
Personal code: <%= @domain.registrant_ident %>
<% else %>
Business Registry code: <%= @domain.registrant_ident %>
<% end %>
Street: <%= @domain.registrant_street %>
City: <%= @domain.registrant_city %>
Country: <%= @domain.registrant_country %>
Please contact to your registrar <%= @domain.registrar_name %> if you have any questions.
Best Regards,
Estonian Internet Foundation

View file

@ -0,0 +1,19 @@
Tere,
<br><br>
Domeeni <%= @domain.name %> registreerija <%= @new_registrant_name %> on domeeni registreerija vahetamise taotluse tagasi lükanud.
<br><br>
Küsimuste korral palun võtke ühendust registripidajaga <%= @domain.registrar_name %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad
<br><br>
Lugupidamisega,<br>
Eesti Interneti SA
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Registrant change was declined for the domain <%= @domain.name %>.
<br><br>
Please contact to your registrar <%= @domain.registrar_name %> if you have any questions.
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -0,0 +1,19 @@
Tere,
Domeeni <%= @domain.name %> registreerija <%= @new_registrant_name %> on domeeni registreerija vahetamise taotluse tagasi lükanud.
Küsimuste korral palun võtke ühendust registripidajaga <%= @domain.registrar_name %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad
Lugupidamisega
Eesti Interneti SA
--------------------------------------
Hi,
Registrant change was declined for the domain <%= @domain.name %>.
Please contact to your registrar <%= @domain.registrar_name %> if you have any questions.
Best Regards,
Estonian Internet Foundation

View file

@ -13,7 +13,8 @@ Tänav: <%= @domain.registrant_street %><br>
Linn: <%= @domain.registrant_city %><br> Linn: <%= @domain.registrant_city %><br>
Riik: <%= @domain.registrant_country %> Riik: <%= @domain.registrant_country %>
<br><br> <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> 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><br>
Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:<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 %> <%= link_to @verification_url, @verification_url %>
@ -38,7 +39,8 @@ Street: <%= @domain.registrant_street %><br>
City: <%= @domain.registrant_city %><br> City: <%= @domain.registrant_city %><br>
Country: <%= @domain.registrant_country %> Country: <%= @domain.registrant_country %>
<br><br> <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> 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>
To confirm the update please visit this website, once again review the data and press approve:<br> To confirm the update please visit this website, once again review the data and press approve:<br>
<%= link_to @verification_url, @verification_url %> <%= link_to @verification_url, @verification_url %>
<br><br> <br><br>

View file

@ -0,0 +1,21 @@
Tere,
<br><br>
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
<br><br>
Uued registreerija:<br>
Nimi: <%= @domain.registrant_name %>
<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><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -0,0 +1,21 @@
Tere,
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
Uued registreerija:
Nimi: <%= @domain.registrant_name %>
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 %>
Best Regards,
Estonian Internet Foundation

View file

@ -61,13 +61,13 @@
%tr %tr
%td= link_to(x, [:registrar, x]) %td= link_to(x, [:registrar, x])
- if x.receipt_date - if x.receipt_date
%td= l(x.receipt_date) %td= l(x.receipt_date, format: :date_long)
- elsif x.cancelled? - elsif x.cancelled?
%td.text-grey= t(:cancelled) %td.text-grey= t(:cancelled)
- else - else
%td{class: 'text-danger'}= t(:unpaid) %td{class: 'text-danger'}= t(:unpaid)
%td= l(x.due_date) %td= l(x.due_date, format: :date_long)
%td= x.sum %td= x.sum
.row .row
.col-md-12 .col-md-12

View file

@ -2,21 +2,21 @@
%hr %hr
%dl.dl-horizontal %dl.dl-horizontal
%dt= t(:issue_date) %dt= t(:issue_date)
%dd= l(@invoice.created_at) %dd= l(@invoice.created_at, format: :date_long)
- if @invoice.cancelled? - if @invoice.cancelled?
%dt= t(:cancel_date) %dt= t(:cancel_date)
%dd= l(@invoice.cancelled_at) %dd= l(@invoice.cancelled_at, format: :date_long)
%dt= t(:due_date) %dt= t(:due_date)
- if @invoice.cancelled? - if @invoice.cancelled?
%dd.text-grey= t(:cancelled) %dd.text-grey= t(:cancelled)
- else - else
%dd= l(@invoice.due_date) %dd= l(@invoice.due_date, format: :date_long)
%dt= t(:receipt_date) %dt= t(:receipt_date)
- if @invoice.binded? - if @invoice.binded?
%dd= l(@invoice.receipt_date) %dd= l(@invoice.receipt_date, format: :date_long)
- elsif @invoice.cancelled? - elsif @invoice.cancelled?
%dd.text-grey= t(:cancelled) %dd.text-grey= t(:cancelled)
- else - else

View file

@ -149,21 +149,21 @@
%hr %hr
%dl.dl-horizontal %dl.dl-horizontal
%dt= t(:issue_date) %dt= t(:issue_date)
%dd= l(@invoice.created_at) %dd= l(@invoice.created_at, format: :date_long)
- if @invoice.cancelled? - if @invoice.cancelled?
%dt= t(:cancel_date) %dt= t(:cancel_date)
%dd= l(@invoice.cancelled_at) %dd= l(@invoice.cancelled_at, format: :date_long)
%dt= t(:due_date) %dt= t(:due_date)
- if @invoice.cancelled? - if @invoice.cancelled?
%dd= t(:cancelled) %dd= t(:cancelled)
- else - else
%dd= l(@invoice.due_date) %dd= l(@invoice.due_date, format: :date_long)
%dt= t(:receipt_date) %dt= t(:receipt_date)
- if @invoice.binded? - if @invoice.binded?
%dd= l(@invoice.receipt_date) %dd= l(@invoice.receipt_date, format: :date_long)
- elsif @invoice.cancelled? - elsif @invoice.cancelled?
%dd= t(:cancelled) %dd= t(:cancelled)
- else - else

View file

@ -3,7 +3,7 @@
<command> <command>
<check> <check>
<contact:check <contact:check
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"> xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
<contact:id>sh8013</contact:id> <contact:id>sh8013</contact:id>
</contact:check> </contact:check>
</check> </check>

View file

@ -3,7 +3,7 @@
<command> <command>
<check> <check>
<contact:check <contact:check
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"> xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
<contact:id>sh8013</contact:id> <contact:id>sh8013</contact:id>
<contact:id>sh13</contact:id> <contact:id>sh13</contact:id>
<contact:id>vsdfvq</contact:id> <contact:id>vsdfvq</contact:id>

View file

@ -2,7 +2,7 @@
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command> <command>
<create> <create>
<contact:create xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"> <contact:create xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
<contact:postalInfo> <contact:postalInfo>
<contact:name>Sillius Soddus</contact:name> <contact:name>Sillius Soddus</contact:name>
<contact:addr> <contact:addr>
@ -20,7 +20,7 @@
</contact:create> </contact:create>
</create> </create>
<extension> <extension>
<eis:extdata xmlns:eis="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/eis-1.0.xsd"> <eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:ident type="bic" cc="EE">123</eis:ident> <eis:ident type="bic" cc="EE">123</eis:ident>
<eis:legalDocument type="pdf"> <eis:legalDocument type="pdf">
JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp== JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==

View file

@ -3,7 +3,7 @@
<command> <command>
<delete> <delete>
<contact:delete <contact:delete
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"> xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
<contact:id>sh8013</contact:id> <contact:id>sh8013</contact:id>
<contact:authInfo> <contact:authInfo>
<contact:pw>wrong-one</contact:pw> <contact:pw>wrong-one</contact:pw>
@ -11,7 +11,7 @@
</contact:delete> </contact:delete>
</delete> </delete>
<extension> <extension>
<eis:extdata xmlns:eis="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/eis-1.0.xsd"> <eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf"> <eis:legalDocument type="pdf">
JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp== JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==
</eis:legalDocument> </eis:legalDocument>

View file

@ -2,7 +2,7 @@
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command> <command>
<info> <info>
<contact:info xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"> <contact:info xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
<contact:id>sh8013</contact:id> <contact:id>sh8013</contact:id>
<contact:authInfo> <contact:authInfo>
<contact:pw>Aas34fq</contact:pw> <contact:pw>Aas34fq</contact:pw>

View file

@ -2,7 +2,7 @@
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command> <command>
<update> <update>
<contact:update xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"> <contact:update xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
<contact:id>sh8013</contact:id> <contact:id>sh8013</contact:id>
<contact:chg> <contact:chg>
<contact:postalInfo> <contact:postalInfo>
@ -25,7 +25,7 @@
</contact:update> </contact:update>
</update> </update>
<extension> <extension>
<eis:extdata xmlns:eis="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/eis-1.0.xsd"> <eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf"> <eis:legalDocument type="pdf">
JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp== JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==
</eis:legalDocument> </eis:legalDocument>

View file

@ -3,7 +3,7 @@
<command> <command>
<check> <check>
<domain:check <domain:check
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"> xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>example.ee</domain:name> <domain:name>example.ee</domain:name>
</domain:check> </domain:check>
</check> </check>

View file

@ -3,7 +3,7 @@
<command> <command>
<create> <create>
<domain:create <domain:create
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"> xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>example.ee</domain:name> <domain:name>example.ee</domain:name>
<domain:period unit="y">1</domain:period> <domain:period unit="y">1</domain:period>
<domain:ns> <domain:ns>
@ -33,7 +33,7 @@
</secDNS:create> </secDNS:create>
</extension> </extension>
<extension> <extension>
<eis:extdata xmlns:eis="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/eis-1.0.xsd"> <eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf"> <eis:legalDocument type="pdf">
JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp== JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==
</eis:legalDocument> </eis:legalDocument>

View file

@ -3,12 +3,12 @@
<command> <command>
<delete> <delete>
<domain:delete <domain:delete
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"> xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>example.ee</domain:name> <domain:name>example.ee</domain:name>
</domain:delete> </domain:delete>
</delete> </delete>
<extension> <extension>
<eis:extdata xmlns:eis="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/eis-1.0.xsd"> <eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf"> <eis:legalDocument type="pdf">
JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp== JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==
</eis:legalDocument> </eis:legalDocument>

View file

@ -3,7 +3,7 @@
<command> <command>
<info> <info>
<domain:info <domain:info
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"> xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name hosts="all">example.ee</domain:name> <domain:name hosts="all">example.ee</domain:name>
<domain:authInfo> <domain:authInfo>
<domain:pw>2fooBAR</domain:pw> <domain:pw>2fooBAR</domain:pw>

View file

@ -3,7 +3,7 @@
<command> <command>
<renew> <renew>
<domain:renew <domain:renew
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"> xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>example.ee</domain:name> <domain:name>example.ee</domain:name>
<domain:curExpDate>2014-08-07</domain:curExpDate> <domain:curExpDate>2014-08-07</domain:curExpDate>
<domain:period unit="y">1</domain:period> <domain:period unit="y">1</domain:period>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command> <command>
<transfer op="query"> <transfer op="request">
<domain:transfer <domain:transfer
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"> xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>example.ee</domain:name> <domain:name>example.ee</domain:name>
<domain:authInfo> <domain:authInfo>
<domain:pw roid="JD1234-REP">2BARfoo</domain:pw> <domain:pw roid="JD1234-REP">2BARfoo</domain:pw>
@ -11,7 +11,7 @@
</domain:transfer> </domain:transfer>
</transfer> </transfer>
<extension> <extension>
<eis:extdata xmlns:eis="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/eis-1.0.xsd"> <eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf"> <eis:legalDocument type="pdf">
JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp== JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==
</eis:legalDocument> </eis:legalDocument>

View file

@ -3,7 +3,7 @@
<command> <command>
<update> <update>
<domain:update <domain:update
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd"> xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>example.ee</domain:name> <domain:name>example.ee</domain:name>
<domain:chg> <domain:chg>
<domain:registrant>mak21</domain:registrant> <domain:registrant>mak21</domain:registrant>
@ -37,7 +37,7 @@
</secDNS:update> </secDNS:update>
</extension> </extension>
<extension> <extension>
<eis:extdata xmlns:eis="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/eis-1.0.xsd"> <eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf"> <eis:legalDocument type="pdf">
JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp== JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==
</eis:legalDocument> </eis:legalDocument>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd" xmlns:ext="urn:ietf:params:xml:ns:keyrelay-1.0"> <epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" xmlns:ext="urn:ietf:params:xml:ns:keyrelay-1.0">
<command> <command>
<ext:keyrelay> <ext:keyrelay>
<ext:name>example6.ee</ext:name> <ext:name>example6.ee</ext:name>
@ -16,7 +16,7 @@
<ext:relative>P1D</ext:relative> <ext:relative>P1D</ext:relative>
</ext:expiry> </ext:expiry>
</ext:keyrelay> </ext:keyrelay>
<eis:extdata xmlns:eis="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/eis-1.0.xsd"> <eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf">JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==</eis:legalDocument> <eis:legalDocument type="pdf">JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==</eis:legalDocument>
</eis:extdata> </eis:extdata>
<ext:clTRID>1422542244</ext:clTRID> <ext:clTRID>1422542244</ext:clTRID>

View file

@ -44,18 +44,27 @@ Rails.application.configure do
# The available log levels are: :debug, :info, :warn, :error, :fatal, and :unknown, # The available log levels are: :debug, :info, :warn, :error, :fatal, and :unknown,
# corresponding to the log level numbers from 0 up to 5 respectively # corresponding to the log level numbers from 0 up to 5 respectively
config.log_level = :info config.log_level = :debug
# for finding database optimization # for finding database optimization
config.after_initialize do config.after_initialize do
Bullet.enable = true Bullet.enable = true
Bullet.bullet_logger = true Bullet.bullet_logger = true
Bullet.rails_logger = true
Bullet.raise = true # raise an error if n+1 query occurs Bullet.raise = true # raise an error if n+1 query occurs
Bullet.unused_eager_loading_enable = false Bullet.unused_eager_loading_enable = false
# Currenty hard to fix, it is triggered by Epp::Domain.new_from_epp for create request # Currenty hard to fix, it is triggered by Epp::Domain.new_from_epp for create request
Bullet.add_whitelist type: :n_plus_one_query, class_name: 'Contact', association: :registrar Bullet.add_whitelist type: :n_plus_one_query, class_name: 'Contact', association: :registrar
# when domain updates, then we need to update all contact linked status,
# somehow it triggers bullet counter cache for versions,
# there was no output indicating each version where fetched or counted
# thus needs more investigation
Bullet.add_whitelist type: :counter_cache, class_name: 'Contact', association: :versions
end end
# config.logger = Logger.new(STDOUT)
end end
# In this mode, any jobs you queue will be run in the same thread, synchronously # In this mode, any jobs you queue will be run in the same thread, synchronously

View file

@ -0,0 +1,20 @@
# Log all active model user errors
# rubocop: disable Lint/AssignmentInCondition
# rubocop: disable Style/SignalException
module ActiveModel
class Errors
def add(attribute, message = :invalid, options = {})
message = normalize_message(attribute, message, options)
if exception = options[:strict]
exception = ActiveModel::StrictValidationFailed if exception == true
raise exception, full_message(attribute, message)
end
# CUSTOM logging
Rails.logger.info "USER MSG: ACTIVEMODEL: #{@base.try(:class)} [#{attribute}] #{message}" if message.present?
# END of CUSTOM logging
self[attribute] << message
end
end
end

View file

@ -0,0 +1,8 @@
# Log all user issues raised by active record
# rubocop: disable Metrics/LineLength
class ActiveRecord::Base
after_validation do |m|
Rails.logger.info "USER MSG: ACTIVERECORD: #{m.class} ##{m.id} #{m.errors.full_messages} #{m.errors['epp_errors']}" if m.errors.present?
true
end
end

View file

@ -0,0 +1,31 @@
# Log all flash messages
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/LineLength
module ActionDispatch
class Flash
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Style/MultilineOperationIndentation
def call(env)
@app.call(env)
ensure
session = Request::Session.find(env) || {}
flash_hash = env[KEY]
if flash_hash && (flash_hash.present? || session.key?('flash'))
session["flash"] = flash_hash.to_session_value
# EIS custom logging
Rails.logger.info "USER MSG: FLASH: #{session['flash']['flashes'].inspect}" if session['flash']
# END OF EIS custom logging
env[KEY] = flash_hash.dup
end
if (!session.respond_to?(:loaded?) || session.loaded?) && # (reset_session uses {}, which doesn't implement #loaded?)
session.key?('flash') && session['flash'].nil?
session.delete('flash')
end
end
end
end

View file

@ -22,11 +22,14 @@ if con.present? && con.table_exists?('settings')
Setting.save_default(:ns_max_count, 11) Setting.save_default(:ns_max_count, 11)
Setting.save_default(:transfer_wait_time, 0) Setting.save_default(:transfer_wait_time, 0)
Setting.save_default(:request_confrimation_on_registrant_change_enabled, true)
Setting.save_default(:request_confirmation_on_domain_deletion_enabled, true)
Setting.save_default(:client_side_status_editing_enabled, false) Setting.save_default(:client_side_status_editing_enabled, false)
Setting.save_default(:invoice_number_min, 131050) Setting.save_default(:invoice_number_min, 131050)
Setting.save_default(:invoice_number_max, 149999) Setting.save_default(:invoice_number_max, 149999)
Setting.save_default(:days_to_keep_invoices_active, 30)
Setting.save_default(:days_to_keep_overdue_invoices_active, 30) Setting.save_default(:days_to_keep_overdue_invoices_active, 30)
Setting.save_default(:days_to_renew_domain_before_expire, 90) Setting.save_default(:days_to_renew_domain_before_expire, 90)
Setting.save_default(:expire_warning_period, 15) Setting.save_default(:expire_warning_period, 15)

Some files were not shown because too many files have changed in this diff Show more