Merge branch 'master' into registry-790

# Conflicts:
#	app/models/domain_cron.rb
#	lib/tasks/dev.rake
This commit is contained in:
Artur Beljajev 2018-06-18 16:27:56 +03:00
commit 5b821f4074
77 changed files with 278 additions and 496 deletions

View file

@ -1,4 +0,0 @@
tmp
public/assets
*.svg
import

View file

@ -13,6 +13,7 @@ gem 'SyslogLogger', '2.0', require: 'syslog/logger'
gem 'iso8601', '0.8.6' # for dates and times gem 'iso8601', '0.8.6' # for dates and times
gem 'rails', '4.2.10' # when update, all initializers eis_custom files needs check/update gem 'rails', '4.2.10' # when update, all initializers eis_custom files needs check/update
gem 'rest-client' gem 'rest-client'
gem 'uglifier'
# load env # load env
gem 'figaro', '1.1.1' gem 'figaro', '1.1.1'
@ -103,7 +104,6 @@ gem 'active_model-errors_details' # Backport from Rails 5, https://github.com/ra
group :development do group :development do
gem 'spring' gem 'spring'
gem 'spring-commands-rspec' gem 'spring-commands-rspec'
gem 'rubocop'
# deploy # deploy
gem 'mina', '0.3.1' # for fast deployment gem 'mina', '0.3.1' # for fast deployment

View file

@ -108,7 +108,6 @@ GEM
gyoku (>= 0.4.0) gyoku (>= 0.4.0)
nokogiri nokogiri
arel (6.0.4) arel (6.0.4)
ast (2.3.0)
autodoc (0.6.0) autodoc (0.6.0)
actionpack actionpack
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
@ -279,9 +278,6 @@ GEM
nori (2.6.0) nori (2.6.0)
open4 (1.3.4) open4 (1.3.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
parallel (1.12.0)
parser (2.4.0.0)
ast (~> 2.2)
pdfkit (0.6.2) pdfkit (0.6.2)
pg (0.19.0) pg (0.19.0)
poltergeist (1.14.0) poltergeist (1.14.0)
@ -290,7 +286,6 @@ GEM
websocket-driver (>= 0.2.0) websocket-driver (>= 0.2.0)
polyamorous (1.3.1) polyamorous (1.3.1)
activerecord (>= 3.0) activerecord (>= 3.0)
powerpack (0.1.1)
pry (0.10.1) pry (0.10.1)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.8.1) method_source (~> 0.8.1)
@ -338,8 +333,6 @@ GEM
activesupport (= 4.2.10) activesupport (= 4.2.10)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (2.2.2)
rake
rake (12.3.1) rake (12.3.1)
ransack (1.5.1) ransack (1.5.1)
actionpack (>= 3.0) actionpack (>= 3.0)
@ -377,14 +370,6 @@ GEM
rspec-mocks (~> 3.6.0) rspec-mocks (~> 3.6.0)
rspec-support (~> 3.6.0) rspec-support (~> 3.6.0)
rspec-support (3.6.0) rspec-support (3.6.0)
rubocop (0.49.1)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
ruby_parser (3.8.4) ruby_parser (3.8.4)
sexp_processor (~> 4.1) sexp_processor (~> 4.1)
safe_yaml (1.0.4) safe_yaml (1.0.4)
@ -439,10 +424,11 @@ GEM
tilt (1.4.1) tilt (1.4.1)
tzinfo (1.2.5) tzinfo (1.2.5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.1.11)
execjs (>= 0.3.0, < 3)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.2) unf_ext (0.0.7.2)
unicode-display_width (1.3.0)
unicode_utils (1.4.0) unicode_utils (1.4.0)
uniform_notifier (1.9.0) uniform_notifier (1.9.0)
uuidtools (2.1.5) uuidtools (2.1.5)
@ -527,7 +513,6 @@ DEPENDENCIES
ransack (= 1.5.1) ransack (= 1.5.1)
rest-client rest-client
rspec-rails (~> 3.6) rspec-rails (~> 3.6)
rubocop
sass-rails (= 5.0.6) sass-rails (= 5.0.6)
sdoc (= 0.4.1) sdoc (= 0.4.1)
select2-rails (= 3.5.9.3) select2-rails (= 3.5.9.3)
@ -536,6 +521,7 @@ DEPENDENCIES
simpleidn (= 0.0.7) simpleidn (= 0.0.7)
spring spring
spring-commands-rspec spring-commands-rspec
uglifier
uuidtools (= 2.1.5) uuidtools (= 2.1.5)
validates_email_format_of (= 1.6.3) validates_email_format_of (= 1.6.3)
webmock webmock

View file

@ -3,8 +3,7 @@ module Admin
load_and_authorize_resource load_and_authorize_resource
before_action :set_default_dates, only: [:index] before_action :set_default_dates, only: [:index]
def index # rubocop: disable Metrics/AbcSize def index
ca_cache = params[:q][:created_at_lteq] ca_cache = params[:q][:created_at_lteq]
begin begin
end_time = params[:q][:created_at_lteq].try(:to_date) end_time = params[:q][:created_at_lteq].try(:to_date)

View file

@ -4,9 +4,6 @@ module Admin
authorize_resource authorize_resource
helper_method :force_delete_templates helper_method :force_delete_templates
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
def index def index
params[:q] ||= {} params[:q] ||= {}
if params[:statuses_contains] if params[:statuses_contains]
@ -35,10 +32,6 @@ module Admin
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
def show def show
# Validation is needed to warn users # Validation is needed to warn users
@domain.validate @domain.validate

View file

@ -18,8 +18,6 @@ class Epp::DomainsController < EppController
render_epp_response '/epp/domains/info' render_epp_response '/epp/domains/info'
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def create def create
authorize! :create, Epp::Domain authorize! :create, Epp::Domain
@domain = Epp::Domain.new_from_epp(params[:parsed_frame], current_user) @domain = Epp::Domain.new_from_epp(params[:parsed_frame], current_user)
@ -46,8 +44,6 @@ class Epp::DomainsController < EppController
end end
end end
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def update def update
authorize! :update, @domain, @password authorize! :update, @domain, @password

View file

@ -1,7 +1,6 @@
class Epp::KeyrelaysController < EppController class Epp::KeyrelaysController < EppController
skip_authorization_check # TODO: move authorization under ability skip_authorization_check # TODO: move authorization under ability
# rubocop: disable Metrics/CyclomaticComplexity
def keyrelay def keyrelay
# keyrelay temp turned off # keyrelay temp turned off
@domain = find_domain @domain = find_domain
@ -29,7 +28,6 @@ class Epp::KeyrelaysController < EppController
exactly_one_of 'expiry > relative', 'expiry > absolute' exactly_one_of 'expiry > relative', 'expiry > absolute'
end end
# rubocop: enable Metrics/CyclomaticComplexity
def find_domain def find_domain
domain_name = params[:parsed_frame].css('name').text.strip.downcase domain_name = params[:parsed_frame].css('name').text.strip.downcase

View file

@ -5,10 +5,6 @@ class Epp::SessionsController < EppController
render_epp_response('greeting') render_epp_response('greeting')
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
def login def login
success = true success = true
@api_user = ApiUser.find_by(login_params) @api_user = ApiUser.find_by(login_params)
@ -101,10 +97,6 @@ class Epp::SessionsController < EppController
handle_errors handle_errors
end end
end end
# rubocop: enable Metrics/MethodLength
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def ip_white? def ip_white?
webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip) webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip)

View file

@ -1,5 +1,4 @@
class EppController < ApplicationController class EppController < ApplicationController
include Iptable
layout false layout false
protect_from_forgery with: :null_session protect_from_forgery with: :null_session
skip_before_action :verify_authenticity_token skip_before_action :verify_authenticity_token
@ -59,11 +58,9 @@ class EppController < ApplicationController
end end
if Rails.env.test? || Rails.env.development? if Rails.env.test? || Rails.env.development?
# rubocop:disable Rails/Output
puts e.backtrace.reverse.join("\n") puts e.backtrace.reverse.join("\n")
puts "\n BACKTRACE REVERSED!\n" puts "\n BACKTRACE REVERSED!\n"
puts "\n FROM-EPP-RESCUE: #{e.message}\n\n\n" puts "\n FROM-EPP-RESCUE: #{e.message}\n\n\n"
# rubocop:enable Rails/Output
else else
logger.error "FROM-EPP-RESCUE: #{e.message}" logger.error "FROM-EPP-RESCUE: #{e.message}"
logger.error e.backtrace.join("\n") logger.error e.backtrace.join("\n")
@ -78,9 +75,7 @@ class EppController < ApplicationController
end end
def generate_svtrid def generate_svtrid
# rubocop: disable Style/VariableName
@svTRID = "ccReg-#{format('%010d', rand(10**10))}" @svTRID = "ccReg-#{format('%010d', rand(10**10))}"
# rubocop: enable Style/VariableName
end end
def params_hash # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE def params_hash # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE
@ -324,16 +319,12 @@ class EppController < ApplicationController
epp_errors.empty? epp_errors.empty?
end end
# rubocop: disable Style/PredicateName
def has_attribute(ph, path) # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE def has_attribute(ph, path) # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE
path.reduce(ph) do |location, key| path.reduce(ph) do |location, key|
location.respond_to?(:keys) ? location[key] : nil location.respond_to?(:keys) ? location[key] : nil
end end
end end
# rubocop: enable Style/PredicateName
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
def write_to_epp_log def write_to_epp_log
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
frame = params[:raw_frame] || params[:frame] frame = params[:raw_frame] || params[:frame]
@ -356,14 +347,6 @@ class EppController < ApplicationController
uuid: request.uuid uuid: request.uuid
}) })
end end
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/PerceivedComplexity
def iptables_counter_update
return if ENV['iptables_counter_enabled'].blank? && ENV['iptables_counter_enabled'] != 'true'
return if current_user.blank?
counter_update(current_user.registrar_code, ENV['iptables_server_ip'])
end
def resource def resource
name = self.class.to_s.sub("Epp::","").sub("Controller","").underscore.singularize name = self.class.to_s.sub("Epp::","").sub("Controller","").underscore.singularize
@ -407,4 +390,26 @@ class EppController < ApplicationController
timeout = 5.minutes timeout = 5.minutes
epp_session.updated_at < (Time.zone.now - timeout) epp_session.updated_at < (Time.zone.now - timeout)
end end
def iptables_counter_update
return if ENV['iptables_counter_enabled'].blank? && ENV['iptables_counter_enabled'] != 'true'
return if current_user.blank?
counter_update(current_user.registrar_code, ENV['iptables_server_ip'])
end
def counter_update(registrar_code, ip)
counter_proc = "/proc/net/xt_recent/#{registrar_code}"
begin
File.open(counter_proc, 'a') do |f|
f.puts "+#{ip}"
end
rescue Errno::ENOENT => e
logger.error "IPTABLES COUNTER UPDATE: cannot open #{counter_proc}: #{e}"
rescue Errno::EACCES => e
logger.error "IPTABLES COUNTER UPDATE: no permission #{counter_proc}: #{e}"
rescue IOError => e
logger.error "IPTABLES COUNTER UPDATE: cannot write #{ip} to #{counter_proc}: #{e}"
end
end
end end

View file

@ -8,8 +8,6 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
@domain = nil unless @domain.registrant_delete_confirmable?(params[:token]) @domain = nil unless @domain.registrant_delete_confirmable?(params[:token])
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/AbcSize
def update def update
@domain = Domain.find(params[:id]) @domain = Domain.find(params[:id])
unless @domain.registrant_delete_confirmable?(params[:token]) unless @domain.registrant_delete_confirmable?(params[:token])
@ -41,6 +39,4 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
end end
end end
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/AbcSize
end end

View file

@ -8,8 +8,6 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
@domain = nil unless @domain.registrant_update_confirmable?(params[:token]) @domain = nil unless @domain.registrant_update_confirmable?(params[:token])
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/AbcSize
def update def update
@domain = Domain.find(params[:id]) @domain = Domain.find(params[:id])
unless @domain.registrant_update_confirmable?(params[:token]) unless @domain.registrant_update_confirmable?(params[:token])
@ -41,6 +39,4 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
end end
end end
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/AbcSize
end end

View file

@ -4,7 +4,6 @@ class Registrant::SessionsController < Devise::SessionsController
def login def login
end end
# rubocop: disable Metrics/AbcSize
def id def id
id_code, id_issuer = request.env['SSL_CLIENT_S_DN'], request.env['SSL_CLIENT_I_DN_O'] id_code, id_issuer = request.env['SSL_CLIENT_S_DN'], request.env['SSL_CLIENT_I_DN_O']
id_code, id_issuer = 'test', RegistrantUser::ACCEPTED_ISSUER if Rails.env.development? id_code, id_issuer = 'test', RegistrantUser::ACCEPTED_ISSUER if Rails.env.development?
@ -18,14 +17,12 @@ class Registrant::SessionsController < Devise::SessionsController
redirect_to registrant_login_url redirect_to registrant_login_url
end end
end end
# rubocop: enable Metrics/AbcSize
def login_mid def login_mid
@user = User.new @user = User.new
end end
# rubocop: disable Metrics/MethodLength def mid
def mid
phone = params[:user][:phone] phone = params[:user][:phone]
endpoint = "#{ENV['sk_digi_doc_service_endpoint']}" endpoint = "#{ENV['sk_digi_doc_service_endpoint']}"
client = Digidoc::Client.new(endpoint) client = Digidoc::Client.new(endpoint)
@ -57,11 +54,7 @@ class Registrant::SessionsController < Devise::SessionsController
render json: { message: t(:no_such_user) }, status: :unauthorized render json: { message: t(:no_such_user) }, status: :unauthorized
end end
end end
# rubocop: enable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
def mid_status def mid_status
endpoint = "#{ENV['sk_digi_doc_service_endpoint']}" endpoint = "#{ENV['sk_digi_doc_service_endpoint']}"
client = Digidoc::Client.new(endpoint) client = Digidoc::Client.new(endpoint)
@ -99,9 +92,6 @@ class Registrant::SessionsController < Devise::SessionsController
render json: { message: t(:internal_error) }, status: :bad_request render json: { message: t(:internal_error) }, status: :bad_request
end end
end end
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/MethodLength
def find_user_by_idc(idc) def find_user_by_idc(idc)
return User.new unless idc return User.new unless idc

View file

@ -1,11 +0,0 @@
# As non-GDPR compliant, this controller is deprecated. Needs to be replaced with one that relies
# on the REST WHOIS API.
class Registrant::WhoisController < RegistrantController
def index
authorize! :view, :registrant_whois
if params[:domain_name].present?
@domain = WhoisRecord.find_by(name: params[:domain_name]);
end
end
end

View file

@ -2,7 +2,7 @@ class Registrar
class AccountActivitiesController < BaseController class AccountActivitiesController < BaseController
load_and_authorize_resource load_and_authorize_resource
def index # rubocop: disable Metrics/AbcSize def index
params[:q] ||= {} params[:q] ||= {}
account = current_user.registrar.cash_account account = current_user.registrar.cash_account

View file

@ -3,10 +3,6 @@ class Registrar
before_action :init_domain, except: :new before_action :init_domain, except: :new
helper_method :contacts helper_method :contacts
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/MethodLength
def index def index
authorize! :view, Depp::Domain authorize! :view, Depp::Domain
@ -58,10 +54,6 @@ class Registrar
end end
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
def info def info
authorize! :info, Depp::Domain authorize! :info, Depp::Domain
@data = @domain.info(params[:domain_name]) if params[:domain_name] @data = @domain.info(params[:domain_name]) if params[:domain_name]

View file

@ -1,9 +1,5 @@
class Ability class Ability
include CanCan::Ability include CanCan::Ability
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/LineLength
# rubocop: disable Metrics/AbcSize
def initialize(user, ip = nil) def initialize(user, ip = nil)
@ip = ip @ip = ip
alias_action :show, to: :view alias_action :show, to: :view
@ -128,8 +124,4 @@ class Ability
def user def user
can :show, :dashboard can :show, :dashboard
end end
# rubocop: enable Metrics/LineLength
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/PerceivedComplexity
end end

View file

@ -28,7 +28,7 @@ class AccountActivity < ActiveRecord::Base
CSV.generate(headers: true) do |csv| CSV.generate(headers: true) do |csv|
csv << %w(registrar description activity_type receipt_date sum) csv << %w(registrar description activity_type receipt_date sum)
all.each do |x| # rubocop:disable Rails/FindEach all.each do |x|
attrs = [x.account.registrar.try(:code)] attrs = [x.account.registrar.try(:code)]
attrs += attributes.map { |attr| x.send(attr) } attrs += attributes.map { |attr| x.send(attr) }
csv << attrs csv << attrs

View file

@ -29,7 +29,6 @@ class BankStatement < ActiveRecord::Base
File.open(import_file_path, 'w') { |f| f.write(th6_file.open.read) } File.open(import_file_path, 'w') { |f| f.write(th6_file.open.read) }
end end
# rubocop: disable Metrics/AbcSize
def parse_th6_row(row) def parse_th6_row(row)
return parse_th6_header(row) if row[4, 3].strip == '000' return parse_th6_header(row) if row[4, 3].strip == '000'
return if row[4, 3].strip == '999' # skip footer return if row[4, 3].strip == '999' # skip footer
@ -50,7 +49,6 @@ class BankStatement < ActiveRecord::Base
reference_no: row[280, 35].strip reference_no: row[280, 35].strip
} }
end end
# rubocop: enable Metrics/AbcSize
def parse_th6_header(row) def parse_th6_header(row)
self.bank_code = row[7, 3].strip self.bank_code = row[7, 3].strip

View file

@ -36,8 +36,6 @@ class BankTransaction < ActiveRecord::Base
# For successful binding, reference number, invoice id and sum must match with the invoice # For successful binding, reference number, invoice id and sum must match with the invoice
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def autobind_invoice def autobind_invoice
return if binded? return if binded?
return unless registrar return unless registrar
@ -50,8 +48,6 @@ class BankTransaction < ActiveRecord::Base
return if invoice.total != sum return if invoice.total != sum
create_activity(registrar, invoice) create_activity(registrar, invoice)
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def bind_invoice(invoice_no) def bind_invoice(invoice_no)
if binded? if binded?

View file

@ -76,7 +76,6 @@ class Certificate < ActiveRecord::Base
@cached_status = REVOKED @cached_status = REVOKED
end end
# rubocop: disable Metrics/AbcSize
def sign! def sign!
csr_file = Tempfile.new('client_csr') csr_file = Tempfile.new('client_csr')
csr_file.write(csr) csr_file.write(csr)
@ -102,13 +101,10 @@ class Certificate < ActiveRecord::Base
errors.add(:base, I18n.t('failed_to_create_certificate')) errors.add(:base, I18n.t('failed_to_create_certificate'))
end end
logger.error(err) logger.error(err)
# rubocop:disable Rails/Output
puts "Certificate sign issue: #{err.inspect}" if Rails.env.test? puts "Certificate sign issue: #{err.inspect}" if Rails.env.test?
# rubocop:enable Rails/Output
return false return false
end end
end end
# rubocop: enable Metrics/AbcSize
def revoke! def revoke!
crt_file = Tempfile.new('client_crt') crt_file = Tempfile.new('client_crt')

View file

@ -311,7 +311,6 @@ class Contact < ActiveRecord::Base
self[:code] = code if new_record? # cannot change code later self[:code] = code if new_record? # cannot change code later
end end
# rubocop:disable Metrics/CyclomaticComplexity
def generate_code def generate_code
return nil unless new_record? return nil unless new_record?
return nil if registrar.blank? return nil if registrar.blank?
@ -328,7 +327,6 @@ class Contact < ActiveRecord::Base
self[:code] = "#{registrar.code}:#{code}".upcase self[:code] = "#{registrar.code}:#{code}".upcase
end end
# rubocop:enable Metrics/CyclomaticComplexity
alias_method :regenerate_code, :generate_code alias_method :regenerate_code, :generate_code
@ -372,8 +370,6 @@ class Contact < ActiveRecord::Base
end end
def related_domain_descriptions def related_domain_descriptions
ActiveSupport::Deprecation.warn('Use #domain_names_with_roles')
@desc = {} @desc = {}
registrant_domains.each do |dom| registrant_domains.each do |dom|

View file

@ -43,7 +43,6 @@ module Depp
) )
end end
# rubocop:disable Metrics/AbcSize
def find_by_id(id) def find_by_id(id)
data = info_xml(id) data = info_xml(id)
@ -76,7 +75,6 @@ module Depp
statuses: data.css('status').map { |s| [s['s'], s.text] } statuses: data.css('status').map { |s| [s['s'], s.text] }
) )
end end
# rubocop:enable Metrics/AbcSize
def user=(user) def user=(user)
@user = user @user = user
@ -173,8 +171,6 @@ module Depp
handle_errors(data) handle_errors(data)
end end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def update_attributes(params) def update_attributes(params)
self.ident_country_code = params[:ident_country_code] self.ident_country_code = params[:ident_country_code]
self.ident_type = params[:ident_type] self.ident_type = params[:ident_type]
@ -223,8 +219,6 @@ module Depp
data = Depp::Contact.user.request(update_xml) data = Depp::Contact.user.request(update_xml)
handle_errors(data) handle_errors(data)
end end
# rubocop:enbale Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
def delete def delete
delete_xml = Contact.epp_xml.delete( delete_xml = Contact.epp_xml.delete(
@ -238,9 +232,6 @@ module Depp
handle_errors(data) handle_errors(data)
end end
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Style/NegatedIf
# rubocop:disable Style/RedundantSelf
def extension_xml(action) def extension_xml(action)
xml = { _anonymus: [] } xml = { _anonymus: [] }
@ -259,9 +250,6 @@ module Depp
xml[:_anonymus] << legal if legal.present? xml[:_anonymus] << legal if legal.present?
xml xml
end end
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Style/NegatedIf
# rubocop:enable Style/RedundantSelf
def ident_xml def ident_xml
{ {

View file

@ -167,8 +167,6 @@ module Depp
ret.with_indifferent_access ret.with_indifferent_access
end end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def construct_params_from_server_data(data) def construct_params_from_server_data(data)
ret = default_params ret = default_params
ret[:name] = data.css('name').text ret[:name] = data.css('name').text
@ -209,8 +207,6 @@ module Depp
ret ret
end end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
def construct_custom_params_hash(domain_params) def construct_custom_params_hash(domain_params)
custom_params = { _anonymus: [] } custom_params = { _anonymus: [] }
@ -228,8 +224,6 @@ 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
@ -262,8 +256,6 @@ module Depp
chg: chg chg: chg
} }
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) rem_keys = create_dnskeys_hash(old_domain_params) - create_dnskeys_hash(domain_params)

View file

@ -38,7 +38,6 @@ module Depp
private private
# rubocop:disable Metrics/AbcSize
def validate_existance_in_server def validate_existance_in_server
return if errors.any? return if errors.any?
res = server.open_connection res = server.open_connection
@ -64,6 +63,5 @@ module Depp
"port: #{ENV['epp_port']}, cert_path: #{ENV['cert_path']}, key_path: #{ENV['key_path']}" "port: #{ENV['epp_port']}, cert_path: #{ENV['cert_path']}, key_path: #{ENV['key_path']}"
errors.add(:base, :invalid_cert) errors.add(:base, :invalid_cert)
end end
# rubocop:enable Metrics/AbcSize
end end
end end

View file

@ -29,14 +29,12 @@ class Directo < ActiveRecord::Base
"InvoiceDate" => invoice.created_at.strftime("%Y-%m-%dT%H:%M:%S"), "InvoiceDate" => invoice.created_at.strftime("%Y-%m-%dT%H:%M:%S"),
"PaymentTerm" => Setting.directo_receipt_payment_term, "PaymentTerm" => Setting.directo_receipt_payment_term,
"Currency" => invoice.currency, "Currency" => invoice.currency,
"CustomerCode"=> invoice.buyer.accounting_customer_code, "CustomerCode"=> invoice.buyer.accounting_customer_code
'TotalVAT' => ActionController::Base.helpers.number_with_precision(invoice.vat_amount, precision: 2, separator: '.')
){ ){
xml.line( xml.line(
"ProductID" => Setting.directo_receipt_product_name, "ProductID" => Setting.directo_receipt_product_name,
"Quantity" => 1, "Quantity" => 1,
"UnitPriceWoVAT" => ActionController::Base.helpers.number_with_precision(invoice.subtotal, precision: 2, separator: '.'), "UnitPriceWoVAT" => ActionController::Base.helpers.number_with_precision(invoice.subtotal, precision: 2, separator: "."),
'VATCode' => invoice.buyer_vat_no,
"ProductName" => invoice.order "ProductName" => invoice.order
) )
} }

View file

@ -1,4 +1,3 @@
# rubocop: disable Metrics/ClassLength
class Domain < ActiveRecord::Base class Domain < ActiveRecord::Base
include UserEvents include UserEvents
include Versions # version/domain_version.rb include Versions # version/domain_version.rb
@ -200,21 +199,6 @@ class Domain < ActiveRecord::Base
statuses.include? DomainStatus::SERVER_TECH_CHANGE_PROHIBITED statuses.include? DomainStatus::SERVER_TECH_CHANGE_PROHIBITED
end end
def self.clean_expired_pendings
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
DomainCron.send(__method__)
end
def self.start_redemption_grace_period
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
DomainCron.send(__method__)
end
def self.destroy_delete_candidates
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
DomainCron.send(__method__)
end
class << self class << self
def nameserver_required? def nameserver_required?
Setting.nameserver_required Setting.nameserver_required
@ -367,7 +351,6 @@ class Domain < ActiveRecord::Base
manage_automatic_statuses manage_automatic_statuses
end end
# rubocop: disable Metrics/CyclomaticComplexity
def registrant_update_confirmable?(token) def registrant_update_confirmable?(token)
return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any? return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any?
return false unless pending_update? return false unless pending_update?
@ -382,7 +365,6 @@ class Domain < ActiveRecord::Base
return false unless registrant_verification_token == token return false unless registrant_verification_token == token
true true
end end
# rubocop: enable Metrics/CyclomaticComplexity
def registrant_verification_asked? def registrant_verification_asked?
registrant_verification_asked_at.present? && registrant_verification_token.present? registrant_verification_asked_at.present? && registrant_verification_token.present?
@ -553,8 +535,6 @@ class Domain < ActiveRecord::Base
self.outzone_at = Time.current self.outzone_at = Time.current
end end
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
def manage_automatic_statuses def manage_automatic_statuses
if !self.class.nameserver_required? if !self.class.nameserver_required?
deactivate if nameservers.reject(&:marked_for_destruction?).empty? deactivate if nameservers.reject(&:marked_for_destruction?).empty?
@ -571,8 +551,6 @@ class Domain < ActiveRecord::Base
s_h = (statuses & [DomainStatus::SERVER_MANUAL_INZONE, DomainStatus::SERVER_HOLD]).empty? s_h = (statuses & [DomainStatus::SERVER_MANUAL_INZONE, DomainStatus::SERVER_HOLD]).empty?
statuses << DomainStatus::SERVER_HOLD if p_d && s_h statuses << DomainStatus::SERVER_HOLD if p_d && s_h
end end
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/PerceivedComplexity
def children_log def children_log
log = HashWithIndifferentAccess.new log = HashWithIndifferentAccess.new
@ -666,4 +644,3 @@ class Domain < ActiveRecord::Base
exists?(["name ILIKE ?", "%.#{zone.origin}"]) exists?(["name ILIKE ?", "%.#{zone.origin}"])
end end
end end
# rubocop: enable Metrics/ClassLength

View file

@ -19,9 +19,6 @@ class Epp::Contact < Contact
find_by(code: code) find_by(code: code)
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
def attrs_from(frame, new_record: false) def attrs_from(frame, new_record: false)
f = frame f = frame
at = {}.with_indifferent_access at = {}.with_indifferent_access
@ -45,9 +42,6 @@ class Epp::Contact < Contact
at.merge!(ident_attrs(f.css('ident').first)) if new_record at.merge!(ident_attrs(f.css('ident').first)) if new_record
at at
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
def new(frame, registrar) def new(frame, registrar)
return super if frame.blank? return super if frame.blank?

View file

@ -1,4 +1,3 @@
# rubocop: disable Metrics/ClassLength
class Epp::Domain < Domain class Epp::Domain < Domain
include EppErrors include EppErrors
@ -54,7 +53,7 @@ class Epp::Domain < Domain
end end
end end
def epp_code_map # rubocop:disable Metrics/MethodLength def epp_code_map
{ {
'2002' => [ # Command use error '2002' => [ # Command use error
[:base, :domain_already_belongs_to_the_querying_registrar] [:base, :domain_already_belongs_to_the_querying_registrar]
@ -129,10 +128,6 @@ class Epp::Domain < Domain
admin_contacts << regt if admin_domain_contacts.blank? && !regt.org? admin_contacts << regt if admin_domain_contacts.blank? && !regt.org?
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
def attrs_from(frame, current_user, action = nil) def attrs_from(frame, current_user, action = nil)
at = {}.with_indifferent_access at = {}.with_indifferent_access
@ -200,10 +195,6 @@ class Epp::Domain < Domain
frame.css("legalDocument").first.content = doc.path if doc&.persisted? frame.css("legalDocument").first.content = doc.path if doc&.persisted?
self.legal_document_id = doc.id self.legal_document_id = doc.id
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/MethodLength
# rubocop: enable Metrics/AbcSize
def nameservers_attrs(frame, action) def nameservers_attrs(frame, action)
ns_list = nameservers_from(frame) ns_list = nameservers_from(frame)
@ -321,8 +312,6 @@ class Epp::Domain < Domain
attrs attrs
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def dnskeys_attrs(frame, action) def dnskeys_attrs(frame, action)
keys = [] keys = []
return keys if frame.blank? return keys if frame.blank?
@ -347,8 +336,6 @@ class Epp::Domain < Domain
end end
errors.any? ? [] : keys errors.any? ? [] : keys
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
class DnsSecKeys class DnsSecKeys
def initialize(frame) def initialize(frame)
@ -460,8 +447,6 @@ class Epp::Domain < Domain
end end
# 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?
@ -502,8 +487,6 @@ class Epp::Domain < Domain
errors.empty? && super(at) errors.empty? && super(at)
end end
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/CyclomaticComplexity
def apply_pending_update! def apply_pending_update!
preclean_pendings preclean_pendings
@ -608,7 +591,6 @@ class Epp::Domain < Domain
### TRANSFER ### ### TRANSFER ###
# rubocop: disable Metrics/CyclomaticComplexity
def transfer(frame, action, current_user) def transfer(frame, action, current_user)
check_discarded check_discarded
@ -627,10 +609,6 @@ class Epp::Domain < Domain
end end
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
def query_transfer(frame, current_user) def query_transfer(frame, current_user)
if current_user.registrar == registrar if current_user.registrar == registrar
throw :epp_error, { throw :epp_error, {
@ -667,8 +645,6 @@ class Epp::Domain < Domain
return dt return dt
end end
end end
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/MethodLength
def approve_transfer(frame, current_user) def approve_transfer(frame, current_user)
pt = pending_transfer pt = pending_transfer
@ -717,8 +693,6 @@ class Epp::Domain < Domain
pt pt
end end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def keyrelay(parsed_frame, requester) def keyrelay(parsed_frame, requester)
if registrar == requester if registrar == requester
errors.add(:base, :domain_already_belongs_to_the_querying_registrar) and return false errors.add(:base, :domain_already_belongs_to_the_querying_registrar) and return false
@ -762,8 +736,6 @@ class Epp::Domain < Domain
true true
end end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
### VALIDATIONS ### ### VALIDATIONS ###
@ -855,4 +827,3 @@ class Epp::Domain < Domain
end end
end end
end end
# rubocop: enable Metrics/ClassLength

View file

@ -54,8 +54,6 @@ class Registrar < ActiveRecord::Base
end end
end end
# 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(
due_date: (Time.zone.now.to_date + Setting.days_to_keep_invoices_active.days).end_of_day, due_date: (Time.zone.now.to_date + Setting.days_to_keep_invoices_active.days).end_of_day,
@ -99,8 +97,6 @@ class Registrar < ActiveRecord::Base
] ]
) )
end end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
def cash_account def cash_account
accounts.find_by(account_type: Account::CASH) accounts.find_by(account_type: Account::CASH)

View file

@ -1,18 +1,15 @@
require 'countries'
require 'action_view'
class SortedCountry class SortedCountry
class << self class << self
include ActionView::Helpers include ActionView::Helpers
def all_options(selected = nil) def all_options(selected = nil)
quick_options = options_for_select(quick_list, { selected: selected }) quick_options = options_for_select(quick_list, selected: selected)
# no double select # no double select
selected = quick_list.map(&:second).include?(selected) ? '' : selected selected = quick_list.map(&:second).include?(selected) ? '' : selected
all_options = options_for_select([['---', '---']] + all_sorted_truncated, all_options = options_for_select([['---', '---']] + all_sorted_truncated,
{ selected: selected, disabled: ['---'] }) selected: selected, disabled: ['---'])
quick_options + all_options quick_options + all_options
end end
@ -21,12 +18,12 @@ class SortedCountry
def quick_list def quick_list
@quick_list ||= @quick_list ||=
[ [
['Estonia', 'EE'], %w[Estonia' EE],
['Finland', 'FI'], %w[Finland FI],
['Latvia', 'LV'], %w[Latvia LV],
['Lithuania', 'LT'], %w[Lithuania LT],
['Russian Federation', 'RU'], ['Russian Federation', 'RU'],
['Sweden', 'SE'], %w[Sweden SE],
['United States', 'US'] ['United States', 'US']
] ]
end end

View file

@ -17,8 +17,6 @@ class WhoisRecord < ActiveRecord::Base
@generated_json ||= generate_json @generated_json ||= generate_json
end end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def generate_json def generate_json
h = HashWithIndifferentAccess.new h = HashWithIndifferentAccess.new
return h if domain.blank? return h if domain.blank?
@ -99,9 +97,6 @@ class WhoisRecord < ActiveRecord::Base
template = Rails.root.join("app/views/for_models/#{template_name}".freeze) template = Rails.root.join("app/views/for_models/#{template_name}".freeze)
ERB.new(template.read, nil, "-").result(binding) ERB.new(template.read, nil, "-").result(binding)
end end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
def populate def populate
return if domain_id.blank? return if domain_id.blank?

View file

@ -26,13 +26,9 @@ class DomainNameValidator < ActiveModel::EachValidator
value = SimpleIDN.to_unicode(value).mb_chars.downcase.strip value = SimpleIDN.to_unicode(value).mb_chars.downcase.strip
end end
# rubocop: disable Metrics/LineLength
unicode_chars = /\u00E4\u00F5\u00F6\u00FC\u0161\u017E/ # äõöüšž unicode_chars = /\u00E4\u00F5\u00F6\u00FC\u0161\u017E/ # äõöüšž
regexp = /\A[a-zA-Z0-9#{unicode_chars.source}][a-zA-Z0-9#{unicode_chars.source}-]{0,61}[a-zA-Z0-9#{unicode_chars.source}]\.#{general_domains.source}\z/ regexp = /\A[a-zA-Z0-9#{unicode_chars.source}][a-zA-Z0-9#{unicode_chars.source}-]{0,61}[a-zA-Z0-9#{unicode_chars.source}]\.#{general_domains.source}\z/
# rubocop: enable Metrics/LineLength
# rubocop: disable Style/DoubleNegation
!!(value =~ regexp) !!(value =~ regexp)
# rubocop: enable Style/DoubleNegation
end end
def validate_blocked(value) def validate_blocked(value)

View file

@ -41,10 +41,10 @@
<div class="col-sm-6"> <div class="col-sm-6">
<div class="input-group"> <div class="input-group">
<%= f.text_field :valid_from, value: f.object.valid_from.try(:to_s, :dshort), <%= f.text_field :valid_from, value: f.object.valid_from.try(:to_date),
class: 'form-control js-datepicker' %> class: 'form-control js-datepicker' %>
<span class="input-group-addon">-</span> <span class="input-group-addon">-</span>
<%= f.text_field :valid_to, value: f.object.valid_to.try(:to_s, :dshort), <%= f.text_field :valid_to, value: f.object.valid_to.try(:to_date),
class: 'form-control js-datepicker' %> class: 'form-control js-datepicker' %>
</div> </div>
</div> </div>

View file

@ -1,84 +1,86 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<%= I18n.locale.to_s %>"> <html lang="<%= I18n.locale.to_s %>">
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/> <meta content="width=device-width, initial-scale=1" name="viewport"/>
<% if content_for? :head_title %> <% if content_for? :head_title %>
<%= yield :head_title %> <%= yield :head_title %>
<% else %> <% else %>
<title> <title>
<%= t(:registrant_head_title) %> <%= t(:registrant_head_title) %>
</title> </title>
<% end %>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'registrant-manifest', media: 'all' %>
<%= favicon_link_tag 'favicon.ico' %>
</head>
<body>
<!-- Fixed navbar
-->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button aria-expanded="false" class="navbar-toggle collapsed" data-target="#navbar" data-toggle="collapse" type="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<%= link_to registrant_root_path, class: 'navbar-brand' do %>
<%= t(:registrant_head_title) %>
<% if unstable_env.present? %>
<div class="text-center">
<small style="color: #0074B3;">
<%= unstable_env %>
</small>
</div>
<% end %>
<% end %>
</div>
<% if current_user %>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav public-nav">
<% if can? :view, Depp::Domain %>
<% active_class = %w(registrant/domains registrant/check registrant/renew registrant/tranfer registrant/keyrelays).include?(params[:controller]) ? 'active' :nil %>
<li class="<%= active_class %>">
<%= link_to t(:domains), registrant_domains_path %>
</li>
<% end %>
<% active_class = %w(registrant/whois).include?(params[:controller]) ? 'active' :nil %>
<li class="<%= active_class %>">
<%= link_to 'Internet.ee', 'https://internet.ee' %>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<% if user_signed_in? %>
<li>
<%= link_to t(:log_out, user: current_user), '/registrant/logout' %>
</li>
<% end %>
</ul>
</div>
<% end %> <% end %>
</div> <%= csrf_meta_tags %>
</nav> <%= stylesheet_link_tag 'registrant-manifest', media: 'all' %>
<div class="container"> <%= favicon_link_tag 'favicon.ico' %>
<%= render 'shared/flash' %> </head>
<%= yield %> <body>
</div> <!-- Fixed navbar
<footer class="footer"> -->
<div class="container"> <nav class="navbar navbar-default navbar-fixed-top">
<div class="row"> <div class="container">
<div class="col-md-6"> <div class="navbar-header">
<%= image_tag 'eis-logo-et.png' %> <button aria-expanded="false" class="navbar-toggle collapsed" data-target="#navbar" data-toggle="collapse" type="button">
</div> <span class="sr-only">Toggle navigation</span>
<div class="col-md-6 text-right"> <span class="icon-bar"></span>
Version <span class="icon-bar"></span>
<%= CURRENT_COMMIT_HASH %> <span class="icon-bar"></span>
</div> </button>
<%= link_to registrant_root_path, class: 'navbar-brand' do %>
<%= t(:registrant_head_title) %>
<% if unstable_env.present? %>
<div class="text-center">
<small style="color: #0074B3;">
<%= unstable_env %>
</small>
</div>
<% end %>
<% end %>
</div>
<% if current_user %>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav public-nav">
<% if can? :view, Depp::Domain %>
<% active_class = %w(registrant/domains registrant/check registrant/renew registrant/tranfer registrant/keyrelays).include?(params[:controller]) ? 'active' :nil %>
<li class="<%= active_class %>">
<%= link_to t(:domains), registrant_domains_path %>
</li>
<li class="<%= active_class %>">
<%= link_to 'WHOIS', 'https://whois.internet.ee' %>
</li>
<li class="<%= active_class %>">
<%= link_to 'Internet.ee', 'https://internet.ee' %>
</li>
<% end %>
</ul>
<ul class="nav navbar-nav navbar-right">
<% if user_signed_in? %>
<li>
<%= link_to t(:log_out, user: current_user), '/registrant/logout' %>
</li>
<% end %>
</ul>
</div>
<% end %>
</div>
</nav>
<div class="container">
<%= render 'shared/flash' %>
<%= yield %>
</div> </div>
</div> <footer class="footer">
</footer> <div class="container">
<%= javascript_include_tag 'registrant-manifest', async: true %> <div class="row">
</body> <div class="col-md-6">
<%= image_tag 'eis-logo-et.png' %>
</div>
<div class="col-md-6 text-right">
Version
<%= CURRENT_COMMIT_HASH %>
</div>
</div>
</div>
</footer>
<%= javascript_include_tag 'registrant-manifest', async: true %>
</body>
</html> </html>

View file

@ -18,7 +18,7 @@
%th{class: 'col-xs-3'}=custom_sort_link t(:domain_name), :name %th{class: 'col-xs-3'}=custom_sort_link t(:domain_name), :name
%th{class: 'col-xs-3'}=custom_sort_link t(:registrar_name), :registrar_name %th{class: 'col-xs-3'}=custom_sort_link t(:registrar_name), :registrar_name
%th{class: 'col-xs-3'}=custom_sort_link t(:valid_to), :valid_to %th{class: 'col-xs-3'}=custom_sort_link t(:valid_to), :valid_to
%th{class: 'col-xs-3'}=custom_sort_link t(:roles), :roles %th{class: 'col-xs-3'}=custom_sort_link Domain.human_attribute_name(:roles), :roles
%tbody %tbody
- domains.each do |x| - domains.each do |x|
%tr %tr

View file

@ -30,13 +30,13 @@
%br %br
%dt= t(:created) %dt= Contact.human_attribute_name :created_at
%dd %dd
= l(@contact.created_at, format: :short) = l(@contact.created_at, format: :short)
by by
= @contact.name = @contact.name
%dt= t(:updated) %dt= Contact.human_attribute_name :updated_at
%dd %dd
= l(@contact.updated_at, format: :short) = l(@contact.updated_at, format: :short)
by by

View file

@ -25,13 +25,13 @@
<dt><%= t(:valid_to) %></dt> <dt><%= t(:valid_to) %></dt>
<dd><%= l(@domain.valid_to) %></dd> <dd><%= l(@domain.valid_to) %></dd>
<dt><%= t(:outzone_at) %></dt> <dt><%= Domain.human_attribute_name :outzone_at %></dt>
<dd><%= l(@domain.outzone_at) %></dd> <dd><%= l(@domain.outzone_at) %></dd>
<dt><%= t(:delete_at) %></dt> <dt><%= Domain.human_attribute_name :delete_at %></dt>
<dd><%= l(@domain.delete_at) %></dd> <dd><%= l(@domain.delete_at) %></dd>
<dt><%= t(:force_delete_at) %></dt> <dt><%= Domain.human_attribute_name :force_delete_at %></dt>
<dd><%= l(@domain.force_delete_at) %></dd> <dd><%= l(@domain.force_delete_at) %></dd>
</dl> </dl>
</div> </div>

View file

@ -40,8 +40,8 @@ module DomainNameRegistry
# Autoload all model subdirs # Autoload all model subdirs
config.autoload_paths += Dir[Rails.root.join('app', 'models', '**/')] config.autoload_paths += Dir[Rails.root.join('app', 'models', '**/')]
config.autoload_paths << Rails.root.join('lib')
config.eager_load_paths << config.root.join('lib', 'validators') config.eager_load_paths << config.root.join('lib', 'validators')
config.watchable_dirs['lib'] = %i[rb]
# Add the fonts path # Add the fonts path
config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts') config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')

View file

@ -23,7 +23,7 @@ Rails.application.configure do
config.serve_static_files = false config.serve_static_files = false
# Compress JavaScripts and CSS. # Compress JavaScripts and CSS.
# config.assets.js_compressor = :uglifier config.assets.js_compressor = Uglifier.new(harmony: true)
# config.assets.css_compressor = :sass # config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed. # Do not fallback to assets pipeline if a precompiled asset is missed.

View file

@ -1,52 +1,28 @@
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = true config.eager_load = true
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_files = true config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600' config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :test
config.active_support.test_order = :random
ActiveSupport::Deprecation.silenced = true config.active_support.deprecation = :raise
config.logger = ActiveSupport::Logger.new(nil)
# For rails-settings-cached conflict
config.cache_store = :file_store, 'tmp/cache_test'
config.action_view.raise_on_missing_translations = true config.action_view.raise_on_missing_translations = true
# The available log levels are: :debug, :info, :warn, :error, :fatal, and :unknown, # If set to :null_store, Setting.x returns nil after first spec runs (database is emptied)
# corresponding to the log level numbers from 0 up to 5 respectively config.cache_store = :memory_store
config.log_level = :debug
config.active_job.queue_adapter = :test
config.logger = ActiveSupport::Logger.new(nil)
config.active_support.test_order = :random # :random is the default in Rails 5
end end
# In this mode, any jobs you queue will be run in the same thread, synchronously Que.mode = :sync
# (that is, MyJob.enqueue runs the job and won't return until it's completed).
# This makes your application's behavior easier to test
Que.mode = :sync

View file

@ -1,3 +0,0 @@
# Some handy day formats
Date::DATE_FORMATS[:dshort] = "%d.%m.%Y"
Time::DATE_FORMATS[:dshort] = "%d.%m.%Y"

View file

@ -1,3 +1,5 @@
require 'devise_custom_failure'
# Use this hook to configure devise mailer, warden hooks and so forth. # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model. # Many of these configuration options can be set straight in your model.
Devise.setup do |config| Devise.setup do |config|

View file

@ -1,5 +1,4 @@
# EIS custom rack hack in order to enable test external interfaces EPP/REPP inside webserver network # EIS custom rack hack in order to enable test external interfaces EPP/REPP inside webserver network
# rubocop:disable Metrics/LineLength
module Rack module Rack
class Request class Request
def trusted_proxy?(ip) def trusted_proxy?(ip)
@ -11,4 +10,3 @@ module Rack
end end
end end
end end
# rubocop:enable Metrics/LineLength

View file

@ -0,0 +1,4 @@
require 'core_ext/array'
require 'gem_ext/builder'
require 'gem_ext/i18n'
require 'gem_ext/paper_trail'

View file

@ -51,8 +51,8 @@ if con.present? && con.table_exists?('settings')
Setting.save_default(:redemption_grace_period, 30) Setting.save_default(:redemption_grace_period, 30)
Setting.save_default(:expiration_reminder_mail, 2) Setting.save_default(:expiration_reminder_mail, 2)
Setting.save_default(:registrar_ip_whitelist_enabled, true) Setting.save_default(:registrar_ip_whitelist_enabled, false)
Setting.save_default(:api_ip_whitelist_enabled, true) Setting.save_default(:api_ip_whitelist_enabled, false)
Setting.save_default(:registry_juridical_name, 'Eesti Interneti SA') Setting.save_default(:registry_juridical_name, 'Eesti Interneti SA')
Setting.save_default(:registry_reg_no, '90010019') Setting.save_default(:registry_reg_no, '90010019')

View file

@ -1 +0,0 @@
Dir[File.join(Rails.root, 'lib', 'ext', '*.rb')].each { |x| require x }

View file

@ -1,14 +1,56 @@
preload_app! # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count
threads 1, 4 # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
workers 2 #
port ENV.fetch("PORT") { 3000 }
on_worker_boot do # Specifies the `environment` that Puma will run in.
ActiveSupport.on_load(:active_record) do #
ActiveRecord::Base.establish_connection environment ENV.fetch("RAILS_ENV") { "development" }
end
end
before_fork do # Specifies the number of `workers` to boot in clustered mode.
ActiveRecord::Base.connection_pool.disconnect! # Workers are forked webserver processes. If using threads and workers together
end # the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. If you use this option
# you need to make sure to reconnect any threads in the `on_worker_boot`
# block.
#
# preload_app!
# If you are preloading your application and using Active Record, it's
# recommended that you close any connections to the database before workers
# are forked to prevent connection leakage.
#
# before_fork do
# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
# end
# The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker
# process is booted, this block will be run. If you are using the `preload_app!`
# option, you will want to use this block to reconnect to any threads
# or connections that may have been created at application boot, as Ruby
# cannot share connections between processes.
#
# on_worker_boot do
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end
#
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart

View file

@ -1,4 +1,4 @@
require 'epp_constraint' require_dependency 'epp_constraint'
Rails.application.routes.draw do Rails.application.routes.draw do
namespace(:epp, defaults: { format: :xml }) do namespace(:epp, defaults: { format: :xml }) do

View file

@ -668,7 +668,6 @@
<text text-anchor="start" x="-72.5" y="-60.8" font-family="Times,serif" font-size="14.00">generate_svtrid</text> <text text-anchor="start" x="-72.5" y="-60.8" font-family="Times,serif" font-size="14.00">generate_svtrid</text>
<text text-anchor="start" x="-72.5" y="-45.8" font-family="Times,serif" font-size="14.00">handle_errors</text> <text text-anchor="start" x="-72.5" y="-45.8" font-family="Times,serif" font-size="14.00">handle_errors</text>
<text text-anchor="start" x="-72.5" y="-30.8" font-family="Times,serif" font-size="14.00">has_attribute</text> <text text-anchor="start" x="-72.5" y="-30.8" font-family="Times,serif" font-size="14.00">has_attribute</text>
<text text-anchor="start" x="-72.5" y="-15.8" font-family="Times,serif" font-size="14.00">iptables_counter_update</text>
<text text-anchor="start" x="-72.5" y="-0.8" font-family="Times,serif" font-size="14.00">latin_only</text> <text text-anchor="start" x="-72.5" y="-0.8" font-family="Times,serif" font-size="14.00">latin_only</text>
<text text-anchor="start" x="-72.5" y="14.2" font-family="Times,serif" font-size="14.00">mutually_exclusive</text> <text text-anchor="start" x="-72.5" y="14.2" font-family="Times,serif" font-size="14.00">mutually_exclusive</text>
<text text-anchor="start" x="-72.5" y="29.2" font-family="Times,serif" font-size="14.00">optional</text> <text text-anchor="start" x="-72.5" y="29.2" font-family="Times,serif" font-size="14.00">optional</text>

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Before After
Before After

View file

@ -1,5 +1,5 @@
class Array class Array
def include_any? *args def include_any?(*args)
(self & args).any? (self & args).any?
end end
end end

View file

@ -1,14 +0,0 @@
require 'builder'
class Builder::XmlMarkup
def epp_head
self.instruct!
epp(
'xmlns' => 'https://epp.tld.ee/schema/epp-ee-1.0.xsd',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation' => 'lib/schemas/epp-ee-1.0.xsd'
) do
yield
end
end
end

14
lib/gem_ext/builder.rb Normal file
View file

@ -0,0 +1,14 @@
module Builder
class XmlMarkup
def epp_head
instruct!
epp(
'xmlns' => 'https://epp.tld.ee/schema/epp-ee-1.0.xsd',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation' => 'lib/schemas/epp-ee-1.0.xsd'
) do
yield
end
end
end
end

View file

@ -1,5 +1,5 @@
# Don't raise error when nil # Don't raise error when nil
# http://stackoverflow.com/questions/9467034/rails-i18n-how-to-handle-case-of-a-nil-date-being-passed-ie-lnil # http://stackoverflow.com/questions/9467034/rails-i18n-how-to-handle-case-of-a-nil-date-being-passed-ie-lnil
module I18n module I18n
class << self class << self
alias_method :original_localize, :localize alias_method :original_localize, :localize

View file

@ -8,7 +8,7 @@ end
# Store console and rake changes in versions # Store console and rake changes in versions
if defined?(::Rails::Console) || File.basename($PROGRAM_NAME).split(' ').first == 'spring' if defined?(::Rails::Console) || File.basename($PROGRAM_NAME).split(' ').first == 'spring'
PaperTrail.whodunnit = "console-#{`whoami`.strip}" PaperTrail.whodunnit = "console-#{`whoami`.strip}"
elsif File.basename($PROGRAM_NAME) == "rake" elsif File.basename($PROGRAM_NAME) == 'rake'
# rake username does not work when spring enabled # rake username does not work when spring enabled
PaperTrail.whodunnit = "rake-#{`whoami`.strip} #{ARGV.join ' '}" PaperTrail.whodunnit = "rake-#{`whoami`.strip} #{ARGV.join ' '}"
end end

View file

@ -1,17 +0,0 @@
module Iptable
def counter_update(registrar_code, ip)
counter_proc = "/proc/net/xt_recent/#{registrar_code}"
begin
File.open(counter_proc, 'a') do |f|
f.puts "+#{ip}"
end
rescue Errno::ENOENT => e
logger.error "IPTABLES COUNTER UPDATE: cannot open #{counter_proc}: #{e}"
rescue Errno::EACCES => e
logger.error "IPTABLES COUNTER UPDATE: no permission #{counter_proc}: #{e}"
rescue IOError => e
logger.error "IPTABLES COUNTER UPDATE: cannot write #{ip} to #{counter_proc}: #{e}"
end
end
end

View file

@ -1,5 +1,3 @@
# rubocop: disable Style/SymbolProc
# rubocop: disable Performance/Detect
namespace :import do namespace :import do
# README # README
# #
@ -360,7 +358,6 @@ namespace :import do
legacy_contact_id legacy_contact_id
) )
# rubocop: disable Lint/UselessAssignment
domain_status_columns = %w( domain_status_columns = %w(
description description
value value
@ -368,7 +365,6 @@ namespace :import do
updator_str updator_str
legacy_domain_id legacy_domain_id
) )
# rubocop: enable Lint/UselessAssignment
nameserver_columns = %w( nameserver_columns = %w(
hostname hostname
@ -786,5 +782,3 @@ def parse_zone_ns_data(domain, zone)
end end
[ns_records.strip, a_records.strip, a4_records.strip] [ns_records.strip, a_records.strip, a4_records.strip]
end end
# rubocop: enable Performance/Detect
# rubocop: enable Style/SymbolProc

View file

@ -10,6 +10,7 @@ FactoryBot.define do
email 'test@test.com' email 'test@test.com'
country_code 'US' country_code 'US'
accounting_customer_code 'test' accounting_customer_code 'test'
language 'en'
factory :registrar_with_unlimited_balance do factory :registrar_with_unlimited_balance do
after :create do |registrar| after :create do |registrar|

View file

@ -31,8 +31,6 @@ RSpec.feature 'Contact deletion in registrar area' do
background do background do
allow(Depp::Contact).to receive(:find_by_id).and_return(FakeDeppContact.new) allow(Depp::Contact).to receive(:find_by_id).and_return(FakeDeppContact.new)
allow(Depp::Contact).to receive(:new).and_return(FakeDeppContact.new) allow(Depp::Contact).to receive(:new).and_return(FakeDeppContact.new)
Setting.api_ip_whitelist_enabled = false
Setting.registrar_ip_whitelist_enabled = false
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance, registrar: registrar)) sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance, registrar: registrar))
end end

View file

@ -1,11 +1,16 @@
require 'rails_helper' require 'rails_helper'
RSpec.feature 'Registrar area IP restriction', settings: false do RSpec.feature 'Registrar area IP restriction', settings: false do
background do before do
Setting.registrar_ip_whitelist_enabled = true @original_registrar_ip_whitelist_enabled = Setting.registrar_ip_whitelist_enabled
end
after do
Setting.registrar_ip_whitelist_enabled = @original_registrar_ip_whitelist_enabled
end end
scenario 'notifies the user if his IP is not allowed' do scenario 'notifies the user if his IP is not allowed' do
Setting.registrar_ip_whitelist_enabled = true
visit registrar_root_path visit registrar_root_path
expect(page).to have_text('Access denied from IP 127.0.0.1') expect(page).to have_text('Access denied from IP 127.0.0.1')
end end

View file

@ -6,7 +6,6 @@ RSpec.feature 'Registrar area linked users', settings: false do
username: 'new-user-name') } username: 'new-user-name') }
background do background do
Setting.registrar_ip_whitelist_enabled = false
sign_in_to_registrar_area(user: current_user) sign_in_to_registrar_area(user: current_user)
end end

View file

@ -2,7 +2,6 @@ require 'rails_helper'
RSpec.feature 'Registrar area profile', settings: false do RSpec.feature 'Registrar area profile', settings: false do
background do background do
Setting.registrar_ip_whitelist_enabled = false
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance)) sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance))
end end

View file

@ -4,7 +4,6 @@ RSpec.feature 'Mobile ID login', db: true do
given!(:api_user) { create(:api_user, identity_code: 1234) } given!(:api_user) { create(:api_user, identity_code: 1234) }
background do background do
Setting.registrar_ip_whitelist_enabled = false
digidoc_client = instance_double(Digidoc::Client, authenticate: OpenStruct.new(user_id_code: 1234), session_code: 1234) digidoc_client = instance_double(Digidoc::Client, authenticate: OpenStruct.new(user_id_code: 1234), session_code: 1234)
allow(Digidoc::Client).to receive(:new).and_return(digidoc_client) allow(Digidoc::Client).to receive(:new).and_return(digidoc_client)
end end

View file

@ -1,10 +1,6 @@
require 'rails_helper' require 'rails_helper'
RSpec.feature 'Registrar area password sign-in' do RSpec.feature 'Registrar area password sign-in' do
background do
Setting.registrar_ip_whitelist_enabled = false
end
scenario 'signs in the user with valid credentials' do scenario 'signs in the user with valid credentials' do
create(:api_user_with_unlimited_balance, create(:api_user_with_unlimited_balance,
active: true, active: true,

View file

@ -2,7 +2,6 @@ require 'rails_helper'
RSpec.feature 'Registrar area sign-out', settings: false do RSpec.feature 'Registrar area sign-out', settings: false do
background do background do
Setting.registrar_ip_whitelist_enabled = false
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance)) sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance))
end end

View file

@ -2,6 +2,14 @@ require 'rails_helper'
RSpec.describe Authorization::RestrictedIP do RSpec.describe Authorization::RestrictedIP do
describe '::enabled?', db: true, settings: false do describe '::enabled?', db: true, settings: false do
before do
@original_registrar_ip_whitelist_enabled = Setting.registrar_ip_whitelist_enabled
end
after do
Setting.registrar_ip_whitelist_enabled = @original_registrar_ip_whitelist_enabled
end
context 'when "registrar_ip_whitelist_enabled" is true' do context 'when "registrar_ip_whitelist_enabled" is true' do
before do before do
Setting.registrar_ip_whitelist_enabled = true Setting.registrar_ip_whitelist_enabled = true
@ -13,10 +21,6 @@ RSpec.describe Authorization::RestrictedIP do
end end
context 'when "registrar_ip_whitelist_enabled" is false' do context 'when "registrar_ip_whitelist_enabled" is false' do
before do
Setting.registrar_ip_whitelist_enabled = false
end
specify do specify do
expect(described_class).to_not be_enabled expect(described_class).to_not be_enabled
end end

View file

@ -108,30 +108,6 @@ RSpec.describe Domain do
@domain.registrant_update_confirmable?('123').should == false @domain.registrant_update_confirmable?('123').should == false
end end
it 'should not find any domain pendings to clean' do
Domain.clean_expired_pendings.should == 0
end
it 'should not find any domains with wrong pendings' do
domain = create(:domain)
domain.registrant_verification_asked!('frame-str', '1')
domain.registrant_verification_asked_at = 30.days.ago
domain.save
Domain.clean_expired_pendings.should == 0
end
it 'should clean domain pendings' do
domain = create(:domain)
domain.registrant_verification_asked!('frame-str', '1')
domain.registrant_verification_asked_at = 30.days.ago
domain.pending_delete!
DomainCron.clean_expired_pendings.should == 1
domain.reload.pending_delete?.should == false
domain.pending_json.should == {}
end
it 'should expire domains' do it 'should expire domains' do
Setting.expire_warning_period = 1 Setting.expire_warning_period = 1
Setting.redemption_grace_period = 1 Setting.redemption_grace_period = 1
@ -164,14 +140,6 @@ RSpec.describe Domain do
@domain.statuses.include?(DomainStatus::EXPIRED).should == true @domain.statuses.include?(DomainStatus::EXPIRED).should == true
end end
it 'should start redemption grace period' do
domain = create(:domain)
DomainCron.start_redemption_grace_period
domain.reload
domain.statuses.include?(DomainStatus::SERVER_HOLD).should == false
end
context 'with time period settings' do context 'with time period settings' do
before :example do before :example do
@save_days_to_renew = Setting.days_to_renew_domain_before_expire @save_days_to_renew = Setting.days_to_renew_domain_before_expire

View file

@ -1,6 +1,14 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Registrar area IP restriction', settings: false do RSpec.describe 'Registrar area IP restriction', settings: false do
before do
@original_registrar_ip_whitelist_enabled = Setting.registrar_ip_whitelist_enabled
end
after do
Setting.registrar_ip_whitelist_enabled = @original_registrar_ip_whitelist_enabled
end
context 'when authenticated' do context 'when authenticated' do
before do before do
sign_in_to_registrar_area sign_in_to_registrar_area
@ -39,10 +47,6 @@ RSpec.describe 'Registrar area IP restriction', settings: false do
end end
context 'when IP restriction is disabled' do context 'when IP restriction is disabled' do
before do
Setting.registrar_ip_whitelist_enabled = false
end
specify do specify do
get registrar_root_url get registrar_root_url
follow_redirect! follow_redirect!
@ -77,10 +81,6 @@ RSpec.describe 'Registrar area IP restriction', settings: false do
end end
context 'when IP restriction is disabled' do context 'when IP restriction is disabled' do
before do
Setting.registrar_ip_whitelist_enabled = false
end
specify do specify do
get registrar_login_path get registrar_login_path
expect(response).to be_success expect(response).to be_success

View file

@ -3,10 +3,6 @@ require 'rails_helper'
RSpec.describe 'Registrar area password sign-in', settings: false do RSpec.describe 'Registrar area password sign-in', settings: false do
let!(:user) { create(:api_user, active: true, login: 'test', password: 'testtest') } let!(:user) { create(:api_user, active: true, login: 'test', password: 'testtest') }
before do
Setting.registrar_ip_whitelist_enabled = false
end
it 'signs the user in' do it 'signs the user in' do
post registrar_sessions_path, depp_user: { tag: 'test', password: 'testtest' } post registrar_sessions_path, depp_user: { tag: 'test', password: 'testtest' }
follow_redirect! follow_redirect!

View file

@ -2,7 +2,6 @@ require 'rails_helper'
RSpec.describe 'Registrar area sign-out', settings: false do RSpec.describe 'Registrar area sign-out', settings: false do
before do before do
Setting.registrar_ip_whitelist_enabled = false
sign_in_to_registrar_area sign_in_to_registrar_area
end end

View file

@ -12,7 +12,7 @@ RSpec.describe 'admin/billing/prices/_form' do
allow(view).to receive(:durations).and_return([]) allow(view).to receive(:durations).and_return([])
end end
stub_template '_form_errors' => '' stub_template '_form_errors.html.erb' => ''
end end
describe 'price' do describe 'price' do

View file

@ -5,7 +5,7 @@ RSpec.describe 'admin/dns/zones/index' do
before :example do before :example do
assign(:zones, zones) assign(:zones, zones)
stub_template '_zone' => 'zone-row' stub_template '_zone.html.erb' => 'zone-row'
end end
it 'has title' do it 'has title' do

View file

@ -13,8 +13,8 @@ RSpec.describe 'admin/domains/edit' do
assign(:domain, domain) assign(:domain, domain)
stub_template '_form' => '' stub_template '_form.html.erb' => ''
stub_template '_force_delete_dialog' => '' stub_template '_force_delete_dialog.html.erb' => ''
end end
it 'has force_delete_toggle_btn' do it 'has force_delete_toggle_btn' do

View file

@ -10,11 +10,11 @@ RSpec.describe 'registrar/contacts/_form' do
assign(:contact, contact) assign(:contact, contact)
stub_template 'registrar/shared/_error_messages' => '' stub_template 'registrar/shared/_error_messages.haml' => ''
stub_template 'registrar/contacts/form/_general' => '' stub_template 'registrar/contacts/form/_general.html.haml' => ''
stub_template 'registrar/contacts/form/_address' => 'address info' stub_template 'registrar/contacts/form/_address.html.haml' => 'address info'
stub_template 'registrar/contacts/form/_code' => '' stub_template 'registrar/contacts/form/_code.html.haml' => ''
stub_template 'registrar/contacts/form/_legal_document' => '' stub_template 'registrar/contacts/form/_legal_document.html.haml' => ''
end end
context 'when address processing is enabled' do context 'when address processing is enabled' do

View file

@ -5,11 +5,11 @@ RSpec.describe 'registrar/contacts/show' do
before do before do
assign(:contact, contact) assign(:contact, contact)
stub_template 'shared/_title' => '' stub_template 'shared/_title.html.haml' => ''
stub_template 'registrar/contacts/partials/_general' => '' stub_template 'registrar/contacts/partials/_general.html.haml' => ''
stub_template 'registrar/contacts/partials/_statuses' => '' stub_template 'registrar/contacts/partials/_statuses.html.haml' => ''
stub_template 'registrar/contacts/partials/_domains' => '' stub_template 'registrar/contacts/partials/_domains.html.haml' => ''
stub_template 'registrar/contacts/partials/_address' => 'address info' stub_template 'registrar/contacts/partials/_address.html.haml' => 'address info'
end end
context 'when address processing is enabled' do context 'when address processing is enabled' do

View file

@ -10,10 +10,10 @@ RSpec.describe 'registrar/domains/_form' do
assign(:domain, domain) assign(:domain, domain)
stub_template 'registrar/domains/form/_general' => '' stub_template 'registrar/domains/form/_general.html.haml' => ''
stub_template 'registrar/domains/form/_contacts' => '' stub_template 'registrar/domains/form/_contacts.html.haml' => ''
stub_template 'registrar/domains/form/_nameservers' => '' stub_template 'registrar/domains/form/_nameservers.html.haml' => ''
stub_template 'registrar/domains/form/_dnskeys' => '' stub_template 'registrar/domains/form/_dnskeys.html.haml' => ''
end end
it 'has legal document' do it 'has legal document' do

View file

@ -9,9 +9,16 @@ class RegistrantLayoutTest < ActionDispatch::IntegrationTest
travel_to Time.zone.parse('2010-07-05') travel_to Time.zone.parse('2010-07-05')
end end
def test_has_link_to_rest_whois def teardown
super
travel_back
end
def test_has_link_to_rest_whois_and_internet_ee
visit registrant_domains_url visit registrant_domains_url
assert(has_link?('Internet.ee', href: 'https://internet.ee')) assert(has_link?('Internet.ee', href: 'https://internet.ee'))
refute(has_link?('WHOIS', href: 'registrant/whois')) assert(has_link?('WHOIS', href: 'https://whois.internet.ee'))
end end
end end

View file

@ -4,10 +4,18 @@ class NewInvoicePaymentTest < ActionDispatch::IntegrationTest
def setup def setup
super super
@original_vat_prc = Setting.registry_vat_prc
Setting.registry_vat_prc = 0.2
@user = users(:api_bestnames) @user = users(:api_bestnames)
login_as @user login_as @user
end end
def teardown
super
Setting.registry_vat_prc = @original_vat_prc
end
def create_invoice_and_visit_its_page def create_invoice_and_visit_its_page
visit registrar_invoices_path visit registrar_invoices_path
click_link_or_button 'Add deposit' click_link_or_button 'Add deposit'