diff --git a/.reek b/.reek
index 060f76785..3bdfebb81 100644
--- a/.reek
+++ b/.reek
@@ -103,13 +103,11 @@ UncommunicativeVariableName:
- Epp::Contact#attrs_from
- Epp::Contact#check_availability
- Epp::Domain#check_availability
- - Epp::Domain#copy_and_transfer_contact
- Epp::Domain#domain_contact_attrs_from
- Epp::Domain#domain_status_list_from
- Epp::Domain#domain_statuses_attrs
- Epp::Domain#nameservers_from
- Epp::Domain#parse_period_unit_from_frame
- - Epp::Domain#transfer_domain_contacts
- Epp::Domain#validate_contacts
- Invoice#cancel_overdue_invoices
- Legacy::Db
@@ -209,7 +207,6 @@ DuplicateMethodCall:
- Registrar::DomainsController#normalize_search_parameters
- Registrar::DomainsController#renew
- Registrar::DomainsController#search_contacts
- - Registrar::DomainsController#transfer
- Registrar::DomainsController#update
- Registrar::InvoicesController#index
- Registrar::InvoicesController#normalize_search_parameters
@@ -246,7 +243,6 @@ DuplicateMethodCall:
- Billing::Price#self.effective
- Billing::Price#self.valid
- BusinessRegistryCache#fetch_by_ident_and_cc
- - BusinessRegistryCache#purge
- Certificate#parse_metadata
- Certificate#reload_apache
- Certificate#revoke!
@@ -285,7 +281,6 @@ DuplicateMethodCall:
- Depp::Domain#default_params
- Depp::Domain#renew
- Depp::Keyrelay#keyrelay
- - Depp::User#repp_request
- Depp::User#validate_existance_in_server
- Directo#self.dump_result_to_db
- Directo#self.load_price
@@ -319,7 +314,6 @@ DuplicateMethodCall:
- Epp::Domain#parse_legal_document_from_frame
- Epp::Domain#query_transfer
- Epp::Domain#renew
- - Epp::Domain#transfer_domain_contacts
- Epp::Domain#update
- Epp::Domain#validate_contacts
- Epp::Domain#validate_exp_dates
@@ -765,7 +759,6 @@ TooManyStatements:
- Depp::Domain#create_nameservers_hash
- Depp::Domain#default_params
- Depp::Domain#transfer
- - Depp::User#repp_request
- Depp::User#validate_existance_in_server
- Directo#self.send_monthly_invoices
- Directo#self.send_receipts
@@ -785,7 +778,6 @@ TooManyStatements:
- DomainCron#self.start_expire_period
- DomainCron#self.start_redemption_grace_period
- DomainMailModel#domain_info
- - DomainTransfer#approve_as_client
- Epp::Contact#add_legal_file_to_new
- Epp::Contact#attrs_from
- Epp::Contact#check_availability
@@ -798,7 +790,6 @@ TooManyStatements:
- Epp::Domain#approve_transfer
- Epp::Domain#attrs_from
- Epp::Domain#check_availability
- - Epp::Domain#copy_and_transfer_contact
- Epp::Domain#destroy_attrs
- Epp::Domain#dnskeys_attrs
- Epp::Domain#domain_contact_attrs_from
@@ -814,7 +805,6 @@ TooManyStatements:
- Epp::Domain#reject_transfer
- Epp::Domain#renew
- Epp::Domain#transfer
- - Epp::Domain#transfer_domain_contacts
- Epp::Domain#update
- Epp::Domain#validate_contacts
- Invoice#cancel
@@ -884,7 +874,6 @@ UtilityFunction:
- EppErrors#construct_msg_args_and_value
- Versions#user_from_id_role_username
- Depp::Keyrelay#expiry
- - Epp::Domain#copy_and_transfer_contact
- Epp::Domain#nameservers_from
- Epp::Domain::DnsSecKeys#mark
- Epp::Domain::DnsSecKeys#xm_copy
@@ -947,7 +936,6 @@ FeatureEnvy:
- Depp::Domain#renew
- Depp::Domain#transfer
- Depp::Keyrelay#keyrelay
- - Depp::User#repp_request
- DomainMailModel#format
- Epp::Contact#attach_legal_document
- Epp::Contact#attrs_from
@@ -959,7 +947,6 @@ FeatureEnvy:
- Epp::Domain#destroy_attrs
- Epp::Domain#domain_contact_attrs_from
- Epp::Domain#domain_status_list_from
- - Epp::Domain#transfer_domain_contacts
- LegalDocument#calc_checksum
- Nameserver#find_by_hash_params
- RegistrantUser#find_or_create_by_idc_data
@@ -1094,7 +1081,6 @@ Attribute:
- BankStatement#th6_file
- Versions#version_loader
- Contact#deliver_emails
- - Contact#domain_transfer
- Contact#domains_present
- Contact#legal_document_id
- Counter#value
diff --git a/.travis.yml b/.travis.yml
index 795074687..a5fec1a71 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,9 +4,6 @@ env:
- DB=postgresql
bundler_args: --without development staging production
before_script:
- - "psql -c 'create database registry_test;' -U postgres"
- - "psql -c 'create database registry_whois_test;' -U postgres"
- - "psql -c 'create database registry_api_log_test;' -U postgres"
- "cp config/application-example.yml config/application.yml"
- "cp config/database-travis.yml config/database.yml"
- "bundle exec rake db:setup:all"
diff --git a/Gemfile b/Gemfile
index 32c21e21d..ade4d256c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -41,7 +41,6 @@ gem 'sass-rails', '5.0.6' # sass style
gem 'coffee-rails', '4.1.0' # coffeescript support
gem 'jquery-rails', '4.0.4' # jquery
-gem 'turbolinks', '2.5.3' # faster page load
gem 'selectize-rails', '0.12.1' # include selectize.js for select
gem 'jquery-validation-rails', '1.13.1' # validate on client side
@@ -49,7 +48,6 @@ gem 'jquery-validation-rails', '1.13.1' # validate on client side
gem 'kaminari', '0.16.3' # pagination
gem 'coderay', '1.1.0' # xml console visualize
gem 'html5_validators', '1.2.2' # model requements now automatically on html form
-gem 'nprogress-rails', '0.1.6.7' # visual loader
gem 'select2-rails', '3.5.9.3' # for autocomplete
gem 'liquid', '3.0.6' # for email templates
@@ -59,7 +57,7 @@ gem 'devise', '3.5.4' # authenitcation
# rest api
gem 'grape', '0.12.0'
-gem 'hashie-forbidden_attributes', '0.1.1' # For grape, https://github.com/ruby-grape/grape#rails
+gem 'hashie-forbidden_attributes', '0.1.1' # For grape, https://github.com/ruby-grape/grape/tree/v0.12.0#rails
gem 'jbuilder', '2.2.16' # json api
# registry specfic
@@ -76,9 +74,6 @@ gem 'whenever', '0.9.4', require: false
# country listing
gem 'countries', :require => 'countries/global'
-# cloning activerecord objects
-gem 'deep_cloneable', '2.1.1'
-
# id + mid login
# gem 'digidoc_client', '0.3.0'
gem 'digidoc_client',
diff --git a/Gemfile.lock b/Gemfile.lock
index 74f9082da..c7cddacca 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -165,8 +165,6 @@ GEM
daemons
multi_json (~> 1.0)
database_cleaner (1.6.1)
- deep_cloneable (2.1.1)
- activerecord (>= 3.1.0, < 5.0.0)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
devise (3.5.4)
@@ -281,7 +279,6 @@ GEM
nokogiri (1.8.1)
mini_portile2 (~> 2.3.0)
nori (2.6.0)
- nprogress-rails (0.1.6.7)
open4 (1.3.4)
orm_adapter (0.5.0)
parallel (1.12.0)
@@ -441,8 +438,6 @@ GEM
thor (0.19.4)
thread_safe (0.3.6)
tilt (1.4.1)
- turbolinks (2.5.3)
- coffee-rails
tzinfo (1.2.3)
thread_safe (~> 0.1)
unf (0.1.4)
@@ -497,7 +492,6 @@ DEPENDENCIES
daemons-rails (= 1.2.1)
data_migrate!
database_cleaner
- deep_cloneable (= 2.1.1)
devise (= 3.5.4)
digidoc_client!
epp (= 1.5.0)!
@@ -520,7 +514,6 @@ DEPENDENCIES
mina (= 0.3.1)
money-rails
nokogiri
- nprogress-rails (= 0.1.6.7)
paper_trail!
pdfkit (= 0.6.2)
pg (= 0.19.0)
@@ -545,7 +538,6 @@ DEPENDENCIES
simpleidn (= 0.0.7)
spring
spring-commands-rspec
- turbolinks (= 2.5.3)
uuidtools (= 2.1.5)
validates_email_format_of (= 1.6.3)
webmock
diff --git a/app/api/repp/api.rb b/app/api/repp/api.rb
index 394edfdad..aec46c68b 100644
--- a/app/api/repp/api.rb
+++ b/app/api/repp/api.rb
@@ -57,5 +57,6 @@ module Repp
mount Repp::DomainV1
mount Repp::ContactV1
mount Repp::AccountV1
+ mount Repp::DomainTransfersV1
end
end
diff --git a/app/api/repp/domain_transfers_v1.rb b/app/api/repp/domain_transfers_v1.rb
new file mode 100644
index 000000000..195740f54
--- /dev/null
+++ b/app/api/repp/domain_transfers_v1.rb
@@ -0,0 +1,47 @@
+module Repp
+ class DomainTransfersV1 < Grape::API
+ version 'v1', using: :path
+
+ resource :domain_transfers do
+ post '/' do
+ params do
+ requires :data, type: Hash do
+ requires :domainTransfers, type: Array do
+ requires :domainName, type: String, allow_blank: false
+ requires :transferCode, type: String, allow_blank: false
+ end
+ end
+ end
+
+ new_registrar = current_user.registrar
+ domain_transfers = params['data']['domainTransfers']
+ errors = []
+
+ domain_transfers.each do |domain_transfer|
+ domain_name = domain_transfer['domainName']
+ transfer_code = domain_transfer['transferCode']
+ domain = Domain.find_by(name: domain_name)
+
+ if domain
+ if domain.transfer_code == transfer_code
+ domain.transfer(new_registrar)
+ else
+ errors << { title: "#{domain_name} transfer code is wrong" }
+ end
+ else
+ errors << { title: "#{domain_name} does not exist" }
+ end
+ end
+
+ if errors.none?
+ status 204
+ body false
+ @response = {}
+ else
+ status 400
+ @response = { errors: errors }
+ end
+ end
+ end
+ end
+end
diff --git a/app/api/repp/domain_v1.rb b/app/api/repp/domain_v1.rb
index cd0f01bdf..5e6c286ca 100644
--- a/app/api/repp/domain_v1.rb
+++ b/app/api/repp/domain_v1.rb
@@ -32,7 +32,7 @@ module Repp
domain = ident =~ /\A[0-9]+\z/ ? Domain.find_by(id: ident) : Domain.find_by_idn(ident)
error! I18n.t('errors.messages.epp_domain_not_found'), 404 unless domain
- error! I18n.t('errors.messages.epp_authorization_error'), 401 unless domain.auth_info.eql? request.headers['Auth-Code']
+ error! I18n.t('errors.messages.epp_authorization_error'), 401 unless domain.transfer_code.eql? request.headers['Auth-Code']
contact_repp_json = proc{|contact|
contact.as_json.slice("code", "name", "ident", "ident_type", "ident_country_code", "phone", "email", "street", "city", "zip","country_code", "statuses")
diff --git a/app/assets/javascripts/datepicker.js b/app/assets/javascripts/datepicker.js
index 188dac211..2210612eb 100644
--- a/app/assets/javascripts/datepicker.js
+++ b/app/assets/javascripts/datepicker.js
@@ -12,10 +12,5 @@
dateFields.datepicker();
}
- // For turbolinks
- document.addEventListener('page:change', function() {
- attachDatePicker();
- });
-
attachDatePicker();
})();
diff --git a/app/assets/javascripts/registrant-manifest.coffee b/app/assets/javascripts/registrant-manifest.coffee
index b8ba84bba..eb7577e02 100644
--- a/app/assets/javascripts/registrant-manifest.coffee
+++ b/app/assets/javascripts/registrant-manifest.coffee
@@ -1,13 +1,7 @@
#= require jquery
#= require jquery_ujs
-#= require jquery.validate
-#= require jquery.validate.additional-methods
-#= require turbolinks
#= require bootstrap-sprockets
-#= require jquery.nested_attributes
-#= require shared/jquery.validate.bootstrap
#= require jquery-ui/datepicker
#= require select2
#= require datepicker
#= require shared/general
-#= require registrar/application
diff --git a/app/assets/javascripts/registrar-manifest.coffee b/app/assets/javascripts/registrar-manifest.coffee
index c5d8918b6..656b5cb18 100644
--- a/app/assets/javascripts/registrar-manifest.coffee
+++ b/app/assets/javascripts/registrar-manifest.coffee
@@ -1,6 +1,5 @@
#= require jquery
#= require jquery_ujs
-#= require turbolinks
#= require bootstrap-sprockets
#= require typeahead.bundle.min
#= require jquery.nested_attributes
diff --git a/app/assets/javascripts/registrar/application.coffee b/app/assets/javascripts/registrar/application.coffee
index f1b92f0f1..51ab8e60a 100644
--- a/app/assets/javascripts/registrar/application.coffee
+++ b/app/assets/javascripts/registrar/application.coffee
@@ -1,4 +1,4 @@
-$(document).on 'page:change', ->
+$ ->
$('.js-contact-form').on 'restoreDefault', (e) ->
form = $(e.target)
form.find('.js-ident-tip').hide()
diff --git a/app/assets/javascripts/shared/general.coffee b/app/assets/javascripts/shared/general.coffee
index 05d5ce8ed..8cfbf41b5 100644
--- a/app/assets/javascripts/shared/general.coffee
+++ b/app/assets/javascripts/shared/general.coffee
@@ -1,9 +1,3 @@
-#= require nprogress
-#= require nprogress-turbolinks
-
-NProgress.configure
- showSpinner: false
-
@flash_notice = (msg) ->
$('#flash').find('div').removeClass('bg-danger')
$('#flash').find('div').addClass('bg-success')
@@ -16,7 +10,7 @@ NProgress.configure
$('#flash').find('div').html(msg)
$('#flash').show()
-$(document).on 'page:change', ->
+$ ->
today = new Date()
tomorrow = new Date(today)
tomorrow.setDate(today.getDate() + 1)
diff --git a/app/assets/stylesheets/admin-manifest.sass b/app/assets/stylesheets/admin-manifest.sass
index 4dabdad0c..8a577df91 100644
--- a/app/assets/stylesheets/admin-manifest.sass
+++ b/app/assets/stylesheets/admin-manifest.sass
@@ -1,4 +1,3 @@
-//= require 'shared/general-manifest'
//= require 'admin/admin-bootstrap'
//= require 'jquery-ui/datepicker'
//= require 'select2'
diff --git a/app/assets/stylesheets/registrant-manifest.sass b/app/assets/stylesheets/registrant-manifest.sass
index 154645065..6d0a281fe 100644
--- a/app/assets/stylesheets/registrant-manifest.sass
+++ b/app/assets/stylesheets/registrant-manifest.sass
@@ -1,12 +1,10 @@
-//= require 'shared/general-manifest'
//= require 'registrant/registrant-bootstrap'
//= require 'jquery-ui/datepicker'
//= require 'select2'
//= require 'select2-bootstrap'
@import shared/fonts
@import shared/general
-@import nprogress
-@import nprogress-bootstrap
+@import forms
@import typeaheadjs
@import selectize
@import selectize.bootstrap3
diff --git a/app/assets/stylesheets/registrar-manifest.sass b/app/assets/stylesheets/registrar-manifest.sass
index 8de8ff95a..a5e9c3593 100644
--- a/app/assets/stylesheets/registrar-manifest.sass
+++ b/app/assets/stylesheets/registrar-manifest.sass
@@ -1,12 +1,10 @@
-//= require 'shared/general-manifest'
//= require 'registrar/registrar-bootstrap'
//= require 'jquery-ui/datepicker'
//= require 'select2'
//= require 'select2-bootstrap'
@import shared/fonts
@import shared/general
-@import nprogress
-@import nprogress-bootstrap
+@import forms
@import typeaheadjs
@import selectize
@import selectize.bootstrap3
diff --git a/app/assets/stylesheets/shared/general-bootstrap.sass b/app/assets/stylesheets/shared/general-bootstrap.sass
index 29a605cb7..8f382b017 100644
--- a/app/assets/stylesheets/shared/general-bootstrap.sass
+++ b/app/assets/stylesheets/shared/general-bootstrap.sass
@@ -65,3 +65,6 @@
.required:after
content: "*"
margin: 0 0 0 1px
+
+.tab-content
+ padding-top: 15px
diff --git a/app/assets/stylesheets/shared/general-manifest.sass b/app/assets/stylesheets/shared/general-manifest.sass
deleted file mode 100644
index e69de29bb..000000000
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index ff1e8eb26..87dabad01 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -65,13 +65,6 @@ class ApplicationController < ActionController::Base
user_log_str(current_user)
end
- def depp_current_user
- @depp_current_user ||= Depp::User.new(
- tag: current_user.username,
- password: current_user.password
- )
- end
-
def user_log_str(user)
user.nil? ? 'public' : user.id_role_username
end
diff --git a/app/controllers/registrant/domains_controller.rb b/app/controllers/registrant/domains_controller.rb
index fbd0eff13..7cde44a86 100644
--- a/app/controllers/registrant/domains_controller.rb
+++ b/app/controllers/registrant/domains_controller.rb
@@ -1,13 +1,12 @@
class Registrant::DomainsController < RegistrantController
-
def index
- authorize! :view, :registrant_domains
- params[:q] ||= {}
- normalize_search_parameters do
- @q = domains.search(params[:q])
- @domains = @q.result.page(params[:page])
- end
- @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
+ authorize! :view, :registrant_domains
+ params[:q] ||= {}
+ normalize_search_parameters do
+ @q = domains.search(params[:q])
+ @domains = @q.result.page(params[:page])
+ end
+ @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
end
def show
@@ -15,19 +14,15 @@ class Registrant::DomainsController < RegistrantController
authorize! :read, @domain
end
- def set_domain
- @domain = domains.find(params[:id])
- end
-
def domain_verification_url
authorize! :view, :registrant_domains
dom = domains.find(params[:id])
if (dom.statuses.include?(DomainStatus::PENDING_UPDATE) || dom.statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION)) &&
- dom.pending_json.present?
+ dom.pending_json.present?
- @domain = dom
- confirm_path = get_confirm_path(dom.statuses)
- @verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
+ @domain = dom
+ confirm_path = get_confirm_path(dom.statuses)
+ @verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
else
flash[:warning] = I18n.t('available_verification_url_not_found')
@@ -52,6 +47,12 @@ class Registrant::DomainsController < RegistrantController
end
end
+ private
+
+ def set_domain
+ @domain = domains.find(params[:id])
+ end
+
def domains
ident_cc, ident = @current_user.registrant_ident.split '-'
begin
@@ -82,5 +83,4 @@ class Registrant::DomainsController < RegistrantController
"#{ENV['registrant_url']}/registrant/domain_delete_confirms"
end
end
-
-end
\ No newline at end of file
+end
diff --git a/app/controllers/registrant/sessions_controller.rb b/app/controllers/registrant/sessions_controller.rb
index e1523c919..2ab7e0dde 100644
--- a/app/controllers/registrant/sessions_controller.rb
+++ b/app/controllers/registrant/sessions_controller.rb
@@ -31,12 +31,6 @@ class Registrant::SessionsController < Devise::SessionsController
client = Digidoc::Client.new(endpoint)
client.logger = Rails.application.config.logger unless Rails.env.test?
- if Rails.env.test? && phone == "123"
- @user = ApiUser.find_by(identity_code: "14212128025")
- sign_in(@user, event: :authentication)
- return redirect_to registrant_root_url
- end
-
# country_codes = {'+372' => 'EST'}
response = client.authenticate(
phone: "+372#{phone}",
diff --git a/app/controllers/registrar/domain_transfers_controller.rb b/app/controllers/registrar/domain_transfers_controller.rb
new file mode 100644
index 000000000..0c72b2d93
--- /dev/null
+++ b/app/controllers/registrar/domain_transfers_controller.rb
@@ -0,0 +1,69 @@
+class Registrar
+ class DomainTransfersController < DeppController
+ before_action do
+ authorize! :transfer, Depp::Domain
+ end
+
+ def new
+ end
+
+ def create
+ if params[:batch_file].present?
+ csv = CSV.read(params[:batch_file].path, headers: true)
+ domain_transfers = []
+
+ csv.each do |row|
+ domain_name = row['Domain']
+ transfer_code = row['Transfer code']
+ domain_transfers << { 'domainName' => domain_name, 'transferCode' => transfer_code }
+ end
+
+ uri = URI.parse("#{ENV['repp_url']}domain_transfers")
+ request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
+ request.body = { data: { domainTransfers: domain_transfers } }.to_json
+ request.basic_auth(current_user.username, current_user.password)
+
+
+ if Rails.env.test?
+ response = Net::HTTP.start(uri.hostname, uri.port,
+ use_ssl: (uri.scheme == 'https'),
+ verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
+ http.request(request)
+ end
+ elsif Rails.env.development?
+ client_cert = File.read(ENV['cert_path'])
+ client_key = File.read(ENV['key_path'])
+ response = Net::HTTP.start(uri.hostname, uri.port,
+ use_ssl: (uri.scheme == 'https'),
+ verify_mode: OpenSSL::SSL::VERIFY_NONE,
+ cert: OpenSSL::X509::Certificate.new(client_cert),
+ key: OpenSSL::PKey::RSA.new(client_key)) do |http|
+ http.request(request)
+ end
+ else
+ client_cert = File.read(ENV['cert_path'])
+ client_key = File.read(ENV['key_path'])
+ response = Net::HTTP.start(uri.hostname, uri.port,
+ use_ssl: (uri.scheme == 'https'),
+ cert: OpenSSL::X509::Certificate.new(client_cert),
+ key: OpenSSL::PKey::RSA.new(client_key)) do |http|
+ http.request(request)
+ end
+ end
+
+ if response.code == '204'
+ flash[:notice] = t '.transferred'
+ redirect_to registrar_domains_url
+ else
+ @api_errors = JSON.parse(response.body, symbolize_names: true)[:errors]
+ render :new
+ end
+ else
+ params[:request] = true # EPP domain:transfer "op" attribute
+ domain = Depp::Domain.new(current_user: depp_current_user)
+ @data = domain.transfer(params)
+ render :new unless response_ok?
+ end
+ end
+ end
+end
diff --git a/app/controllers/registrar/domains_controller.rb b/app/controllers/registrar/domains_controller.rb
index 76467ce79..b85923a02 100644
--- a/app/controllers/registrar/domains_controller.rb
+++ b/app/controllers/registrar/domains_controller.rb
@@ -52,7 +52,8 @@ class Registrar
end
csv = Registrar::DomainListCSVPresenter.new(domains: domain_presenters, view: view_context).to_s
- send_data(csv)
+ filename = "Domains_#{l(Time.zone.now, format: :filename)}.csv"
+ send_data(csv, filename: filename)
end
end
end
@@ -146,16 +147,6 @@ class Registrar
end
end
- def transfer
- authorize! :transfer, Depp::Domain
- if request.post? && params[:domain_name]
- @data = @domain.transfer(params)
- render 'transfer_index' and return unless response_ok?
- else
- render 'transfer_index'
- end
- end
-
def search_contacts
authorize! :create, Depp::Domain
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 2b25dc753..3883bbabf 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -54,14 +54,14 @@ class Ability
# can(:create, :epp_request)
# Epp::Domain
- can(:info, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || pw.blank? ? true : d.auth_info == pw }
+ can(:info, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || pw.blank? ? true : d.transfer_code == pw }
can(:check, Epp::Domain)
can(:create, Epp::Domain)
can(:renew, Epp::Domain) { |d| d.registrar_id == @user.registrar_id }
- can(:update, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.auth_info == pw }
- can(:transfer, Epp::Domain) { |d, pw| d.auth_info == pw }
- can(:view_password, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.auth_info == pw }
- can(:delete, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.auth_info == pw }
+ can(:update, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.transfer_code == pw }
+ can(:transfer, Epp::Domain) { |d, pw| d.transfer_code == pw }
+ can(:view_password, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.transfer_code == pw }
+ can(:delete, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.transfer_code == pw }
# Epp::Contact
can(:info, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || pw.blank? ? true : c.auth_info == pw }
diff --git a/app/models/business_registry_cache.rb b/app/models/business_registry_cache.rb
index f73a5cfe8..2e7c06cc8 100644
--- a/app/models/business_registry_cache.rb
+++ b/app/models/business_registry_cache.rb
@@ -19,24 +19,17 @@ authentication using electronic ID. Association through a business organisation
=end
class BusinessRegistryCache < ActiveRecord::Base
-
- # 1. load domains by business
- # 2. load domains by person
- def associated_contacts
- contact_ids = Contact.where(ident_type: 'org', ident: associated_businesses, ident_country_code: 'EE').pluck(:id)
- contact_ids += Contact.where(ident_type: 'priv', ident: ident, ident_country_code: ident_country_code).pluck(:id)
- contact_ids
- end
-
def associated_domain_ids
+ contact_ids = Contact.where(ident_type: 'org', ident: associated_businesses, ident_country_code: ident_country_code).pluck(:id)
+ contact_ids += Contact.where(ident_type: 'priv', ident: ident, ident_country_code: ident_country_code).pluck(:id)
domain_ids = []
- contact_ids = associated_contacts
-
unless contact_ids.blank?
domain_ids = DomainContact.distinct.where(contact_id: contact_ids).pluck(:domain_id)
end
+ domain_ids += Domain.where(registrant_id: contact_ids).pluck(:id)
+
domain_ids
end
@@ -69,15 +62,5 @@ class BusinessRegistryCache < ActiveRecord::Base
def business_registry
Soap::Arireg.new
end
-
- def purge
- STDOUT << "#{Time.zone.now.utc} - Starting Purge of old BusinessRegistry data from cache\n" unless Rails.env.test?
- purged = 0
- BusinessRegistryCache.where('retrieved_on < ?',
- Time.zone.now < Setting.days_to_keep_business_registry_cache.days).each do |br|
- br.destroy and purged += 1
- end
- STDOUT << "#{Time.zone.now.utc} - Finished purging #{purged} old BusinessRegistry cache items\n" unless Rails.env.test?
- end
end
end
diff --git a/app/models/concerns/contact/transferable.rb b/app/models/concerns/contact/transferable.rb
new file mode 100644
index 000000000..e280adfae
--- /dev/null
+++ b/app/models/concerns/contact/transferable.rb
@@ -0,0 +1,28 @@
+module Concerns::Contact::Transferable
+ extend ActiveSupport::Concern
+
+ included do
+ validates :auth_info, presence: true
+ after_initialize :generate_auth_info, if: 'new_record? && auth_info.blank?'
+ end
+
+ def transfer(new_registrar)
+ new_contact = self.dup
+ new_contact.registrar = new_registrar
+ new_contact.original = self
+ new_contact.code = nil
+ new_contact.regenerate_code
+ new_contact.regenerate_auth_info
+ new_contact.remove_address unless self.class.address_processing?
+ new_contact.save!
+ new_contact
+ end
+
+ protected
+
+ def generate_auth_info
+ self.auth_info = SecureRandom.hex(11)
+ end
+
+ alias_method :regenerate_auth_info, :generate_auth_info
+end
diff --git a/app/models/concerns/domain/transferable.rb b/app/models/concerns/domain/transferable.rb
new file mode 100644
index 000000000..62b70a71b
--- /dev/null
+++ b/app/models/concerns/domain/transferable.rb
@@ -0,0 +1,68 @@
+module Concerns::Domain::Transferable
+ extend ActiveSupport::Concern
+
+ included do
+ after_initialize :generate_transfer_code, if: 'new_record? && transfer_code.blank?'
+ end
+
+ def transfer(new_registrar)
+ old_registrar = registrar
+
+ self.registrar = new_registrar
+ regenerate_transfer_code
+
+ contact_codes = contacts.pluck(:code).sort.uniq
+ registrant_code = registrant.code
+
+ transaction do
+ old_registrar.messages.create!(
+ body: I18n.t('domain_transfer_was_approved', contacts: contact_codes, registrant: registrant_code),
+ attached_obj_id: id,
+ attached_obj_type: self.class.name
+ )
+
+ domain_transfers.create!(
+ transfer_requested_at: Time.zone.now,
+ old_registrar: old_registrar,
+ new_registrar: new_registrar
+ )
+
+ transfer_contacts(new_registrar)
+ save!
+ end
+ end
+
+ private
+
+ def generate_transfer_code
+ self.transfer_code = SecureRandom.hex
+ end
+
+ alias_method :regenerate_transfer_code, :generate_transfer_code
+
+ def transfer_contacts(new_registrar)
+ transfer_registrant(new_registrar)
+ transfer_domain_contacts(new_registrar)
+ end
+
+ def transfer_registrant(new_registrar)
+ return if registrant.registrar == new_registrar
+ self.registrant = registrant.transfer(new_registrar)
+ end
+
+ def transfer_domain_contacts(new_registrar)
+ copied_ids = []
+ contacts.each do |contact|
+ next if copied_ids.include?(contact.id) || contact.registrar == new_registrar
+
+ if registrant_id_was == contact.id # registrant was copied previously, do not copy it again
+ oc = OpenStruct.new(id: registrant_id)
+ else
+ oc = contact.transfer(new_registrar)
+ end
+
+ domain_contacts.where(contact_id: contact.id).update_all({ contact_id: oc.id }) # n+1 workaround
+ copied_ids << contact.id
+ end
+ end
+end
diff --git a/app/models/concerns/versions.rb b/app/models/concerns/versions.rb
index 49c4298f2..5e2bad90c 100644
--- a/app/models/concerns/versions.rb
+++ b/app/models/concerns/versions.rb
@@ -67,7 +67,7 @@ module Versions
map do |ver|
o = new(ver.object)
o.version_loader = ver
- ver.object_changes.to_h.each { |k, v| o[k]=v[-1] }
+ ver.object_changes.to_h.each { |k, v| o.public_send("#{k}=", v[-1]) }
o
end
not_in_history = where(id: (ids.to_a - from_history.map(&:id)))
diff --git a/app/models/contact.rb b/app/models/contact.rb
index 61a82ae0a..3024551f8 100644
--- a/app/models/contact.rb
+++ b/app/models/contact.rb
@@ -2,7 +2,9 @@ class Contact < ActiveRecord::Base
include Versions # version/contact_version.rb
include EppErrors
include UserEvents
+ include Concerns::Contact::Transferable
+ belongs_to :original, class_name: self.name
belongs_to :registrar, required: true
has_many :domain_contacts
has_many :domains, through: :domain_contacts
@@ -16,6 +18,7 @@ class Contact < ActiveRecord::Base
attr_accessor :legal_document_id
alias_attribute :kind, :ident_type
+ alias_attribute :copy_from_id, :original_id # Old attribute name; for PaperTrail
accepts_nested_attributes_for :legal_documents
@@ -43,7 +46,6 @@ class Contact < ActiveRecord::Base
before_validation :to_upcase_country_code
before_validation :strip_email
- before_create :generate_auth_info
before_update :manage_emails
composed_of :identifier,
@@ -79,7 +81,6 @@ class Contact < ActiveRecord::Base
PASSPORT = 'passport'
attr_accessor :deliver_emails
- attr_accessor :domain_transfer # hack but solves problem faster
#
# STATUSES
@@ -313,16 +314,6 @@ class Contact < ActiveRecord::Base
!org?
end
- def generate_auth_info
- return if @generate_auth_info_disabled
- return if auth_info.present?
- self.auth_info = SecureRandom.hex(11)
- end
-
- # def auth_info=(pw)
- # self[:auth_info] = pw if new_record?
- # end
-
def code=(code)
self[:code] = code if new_record? # cannot change code later
end
@@ -346,6 +337,8 @@ class Contact < ActiveRecord::Base
end
# rubocop:enable Metrics/CyclomaticComplexity
+ alias_method :regenerate_code, :generate_code
+
def country
Country.new(country_code)
end
diff --git a/app/models/depp/domain.rb b/app/models/depp/domain.rb
index 1351b2672..0032fd958 100644
--- a/app/models/depp/domain.rb
+++ b/app/models/depp/domain.rb
@@ -118,7 +118,7 @@ module Depp
current_user.request(epp_xml.transfer({
name: { value: params[:domain_name] },
- authInfo: { pw: { value: params[:password] } }
+ authInfo: { pw: { value: params[:transfer_code] } }
}, op, Domain.construct_custom_params_hash(params)))
end
diff --git a/app/models/depp/user.rb b/app/models/depp/user.rb
index 51ce3f682..b40d910e4 100644
--- a/app/models/depp/user.rb
+++ b/app/models/depp/user.rb
@@ -36,39 +36,6 @@ module Depp
Nokogiri::XML(e.response_xml.to_s).remove_namespaces!
end
- # rubocop:disable Metrics/AbcSize
- def repp_request(path, params = {})
- client_cert = File.read(ENV['cert_path'])
- client_key = File.read(ENV['key_path'])
-
- repp_url = Rails.env.test? ? 'http://localhost:8989/repp/v1/' : ENV['repp_url']
- uri = URI.parse("#{repp_url}#{path}")
- uri.query = URI.encode_www_form(params)
-
- req = Net::HTTP::Get.new(uri)
- req.basic_auth tag, password
-
- res = Net::HTTP.start(uri.hostname, uri.port,
- use_ssl: (uri.scheme == 'https'),
- verify_mode: OpenSSL::SSL::VERIFY_NONE,
- cert: OpenSSL::X509::Certificate.new(client_cert),
- key: OpenSSL::PKey::RSA.new(client_key)) do |http|
- http.request(req)
- end
-
- ret = OpenStruct.new(code: res.code)
- ret.parsed_body = JSON.parse(res.body) if res.body.present?
-
- if ret.parsed_body && ret.parsed_body['error']
- ret.message = ret.parsed_body['error']
- else
- ret.message = res.message
- end
-
- ret
- end
- # rubocop:enable Metrics/AbcSize
-
private
# rubocop:disable Metrics/AbcSize
diff --git a/app/models/domain.rb b/app/models/domain.rb
index 6d16d617f..31ba838f2 100644
--- a/app/models/domain.rb
+++ b/app/models/domain.rb
@@ -6,6 +6,7 @@ class Domain < ActiveRecord::Base
include Concerns::Domain::Activatable
include Concerns::Domain::ForceDelete
include Concerns::Domain::Deletable
+ include Concerns::Domain::Transferable
has_paper_trail class_name: "DomainVersion", meta: { children: :children_log }
@@ -15,6 +16,7 @@ class Domain < ActiveRecord::Base
alias_attribute :on_hold_time, :outzone_at
alias_attribute :outzone_time, :outzone_at
+ alias_attribute :auth_info, :transfer_code # Old attribute name; for PaperTrail
# 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?
@@ -79,9 +81,7 @@ class Domain < ActiveRecord::Base
self.status_notes = {} if status_notes.nil?
end
- before_create :generate_auth_info
before_create -> { self.reserved = in_reserved_list?; nil }
-
before_save :manage_automatic_statuses
before_save :touch_always_version
def touch_always_version
@@ -105,6 +105,7 @@ class Domain < ActiveRecord::Base
validates :name_dirty, domain_name: true, uniqueness: true
validates :puny_label, length: { maximum: 63 }
validates :period, presence: true, numericality: { only_integer: true }
+ validates :transfer_code, presence: true
validate :validate_reservation
def validate_reservation
@@ -497,19 +498,6 @@ class Domain < ActiveRecord::Base
Registrant.find_by(id: pending_json['new_registrant_id'])
end
- def generate_auth_info
- return if auth_info.present?
- generate_auth_info!
- end
-
- # rubocop:disable Lint/Loop
- def generate_auth_info!
- begin
- self.auth_info = SecureRandom.hex
- end while self.class.exists?(auth_info: auth_info)
- end
- # rubocop:enable Lint/Loop
-
def set_graceful_expired
self.outzone_at = expire_time + self.class.expire_warning_period
self.delete_at = outzone_at + self.class.redemption_grace_period
@@ -672,6 +660,12 @@ class Domain < ActiveRecord::Base
pending_json['new_registrant_id']
end
+ def as_json(_options)
+ hash = super
+ hash['auth_info'] = hash.delete('transfer_code') # API v1 requirement
+ hash
+ end
+
def self.to_csv
CSV.generate do |csv|
csv << column_names
diff --git a/app/models/domain_transfer.rb b/app/models/domain_transfer.rb
index adcd10e50..6dd539bb8 100644
--- a/app/models/domain_transfer.rb
+++ b/app/models/domain_transfer.rb
@@ -1,16 +1,13 @@
class DomainTransfer < ActiveRecord::Base
- include Versions # version/domain_transfer_version.rb
belongs_to :domain
- belongs_to :transfer_from, class_name: 'Registrar'
- belongs_to :transfer_to, class_name: 'Registrar'
+ belongs_to :old_registrar, class_name: 'Registrar'
+ belongs_to :new_registrar, class_name: 'Registrar'
PENDING = 'pending'
CLIENT_APPROVED = 'clientApproved'
- CLIENT_CANCELLED = 'clientCancelled'
CLIENT_REJECTED = 'clientRejected'
SERVER_APPROVED = 'serverApproved'
- SERVER_CANCELLED = 'serverCancelled'
before_create :set_wait_until
def set_wait_until
@@ -39,20 +36,8 @@ class DomainTransfer < ActiveRecord::Base
status == PENDING
end
- def approve_as_client
- transaction do
- self.status = DomainTransfer::CLIENT_APPROVED
- self.transferred_at = Time.zone.now
- save
-
- domain.generate_auth_info
- domain.registrar = transfer_to
- domain.save(validate: false)
- end
- end
-
def notify_losing_registrar(contacts, registrant)
- transfer_from.messages.create!(
+ old_registrar.messages.create!(
body: I18n.t('domain_transfer_was_approved', contacts: contacts, registrant: registrant),
attached_obj_id: id,
attached_obj_type: self.class.to_s
diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb
index 997c77fc5..969d9a9bc 100644
--- a/app/models/epp/domain.rb
+++ b/app/models/epp/domain.rb
@@ -100,7 +100,7 @@ class Epp::Domain < Domain
[:puny_label, :too_long, { obj: 'name', val: name_puny }]
],
'2201' => [ # Authorisation error
- [:auth_info, :wrong_pw]
+ [:transfer_code, :wrong_pw]
],
'2202' => [
[:base, :invalid_auth_information_reserved]
@@ -182,7 +182,7 @@ class Epp::Domain < Domain
# at[:domain_statuses_attributes] = domain_statuses_attrs(frame, action)
pw = frame.css('authInfo > pw').text
- at[:auth_info] = pw if pw.present?
+ at[:transfer_code] = pw if pw.present?
if new_record?
dnskey_frame = frame.css('extension create')
@@ -641,47 +641,6 @@ class Epp::Domain < Domain
end
end
- # TODO: Eager load problems here. Investigate how it's possible not to query contact again
- # Check if versioning works with update_column
- def transfer_contacts(registrar_id)
- transfer_registrant(registrar_id)
- transfer_domain_contacts(registrar_id)
- end
-
- def copy_and_transfer_contact(contact_id, registrar_id)
- c = Contact.find(contact_id) # n+1 workaround
- oc = c.deep_clone
- oc.code = nil
- oc.registrar_id = registrar_id
- oc.copy_from_id = c.id
- oc.generate_code
- oc.domain_transfer = true
- oc.remove_address unless Contact.address_processing?
- oc.save!(validate: false)
- oc
- end
-
- def transfer_registrant(registrar_id)
- return if registrant.registrar_id == registrar_id
- self.registrant_id = copy_and_transfer_contact(registrant_id, registrar_id).id
- end
-
- def transfer_domain_contacts(registrar_id)
- copied_ids = []
- contacts.each do |c|
- next if copied_ids.include?(c.id) || c.registrar_id == registrar_id
-
- if registrant_id_was == c.id # registrant was copied previously, do not copy it again
- oc = OpenStruct.new(id: registrant_id)
- else
- oc = copy_and_transfer_contact(c.id, registrar_id)
- end
-
- domain_contacts.where(contact_id: c.id).update_all({ contact_id: oc.id }) # n+1 workaround
- copied_ids << c.id
- end
- end
-
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
@@ -707,8 +666,8 @@ class Epp::Domain < Domain
transaction do
dt = domain_transfers.create!(
transfer_requested_at: Time.zone.now,
- transfer_to: current_user.registrar,
- transfer_from: registrar
+ old_registrar: registrar,
+ new_registrar: current_user.registrar
)
if dt.pending?
@@ -720,9 +679,9 @@ class Epp::Domain < Domain
end
if dt.approved?
- transfer_contacts(current_user.registrar_id)
+ transfer_contacts(current_user.registrar)
dt.notify_losing_registrar(old_contact_codes, old_registrant_code)
- generate_auth_info!
+ regenerate_transfer_code
self.registrar = current_user.registrar
end
@@ -737,7 +696,7 @@ class Epp::Domain < Domain
def approve_transfer(frame, current_user)
pt = pending_transfer
- if current_user.registrar != pt.transfer_from
+ if current_user.registrar != pt.old_registrar
throw :epp_error, {
msg: I18n.t('transfer_can_be_approved_only_by_current_registrar'),
code: '2304'
@@ -750,9 +709,9 @@ class Epp::Domain < Domain
transferred_at: Time.zone.now
)
- transfer_contacts(pt.transfer_to_id)
- generate_auth_info
- self.registrar = pt.transfer_to
+ transfer_contacts(pt.new_registrar)
+ regenerate_transfer_code
+ self.registrar = pt.new_registrar
attach_legal_document(self.class.parse_legal_document_from_frame(frame))
save!(validate: false)
@@ -763,7 +722,7 @@ class Epp::Domain < Domain
def reject_transfer(frame, current_user)
pt = pending_transfer
- if current_user.registrar != pt.transfer_from
+ if current_user.registrar != pt.old_registrar
throw :epp_error, {
msg: I18n.t('transfer_can_be_rejected_only_by_current_registrar'),
code: '2304'
@@ -872,7 +831,7 @@ class Epp::Domain < Domain
# For domain transfer
def authenticate(pw)
- errors.add(:auth_info, :wrong_pw) if pw != auth_info
+ errors.add(:transfer_code, :wrong_pw) if pw != transfer_code
errors.empty?
end
diff --git a/app/models/registrar.rb b/app/models/registrar.rb
index 418277b8a..7646b2ceb 100644
--- a/app/models/registrar.rb
+++ b/app/models/registrar.rb
@@ -140,8 +140,8 @@ class Registrar < ActiveRecord::Base
def domain_transfers
at = DomainTransfer.arel_table
DomainTransfer.where(
- at[:transfer_to_id].eq(id).or(
- at[:transfer_from_id].eq(id)
+ at[:new_registrar_id].eq(id).or(
+ at[:old_registrar_id].eq(id)
)
)
end
diff --git a/app/models/version/domain_transfer_version.rb b/app/models/version/domain_transfer_version.rb
deleted file mode 100644
index 7005337ba..000000000
--- a/app/models/version/domain_transfer_version.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class DomainTransferVersion < PaperTrail::Version
- include VersionSession
- self.table_name = :log_domain_transfers
- self.sequence_name = :log_domain_transfers_id_seq
-end
diff --git a/app/presenters/domain_presenter.rb b/app/presenters/domain_presenter.rb
index e81aede33..11a066b7a 100644
--- a/app/presenters/domain_presenter.rb
+++ b/app/presenters/domain_presenter.rb
@@ -1,5 +1,5 @@
class DomainPresenter
- delegate :name, :registrant_name, :registrant_id, :registrant_code, to: :domain
+ delegate :name, :transfer_code, :registrant_name, :registrant_id, :registrant_code, to: :domain
def initialize(domain:, view:)
@domain = domain
diff --git a/app/presenters/registrar/domain_list_csv_presenter.rb b/app/presenters/registrar/domain_list_csv_presenter.rb
index d6f0c46bd..5b47cfdcf 100644
--- a/app/presenters/registrar/domain_list_csv_presenter.rb
+++ b/app/presenters/registrar/domain_list_csv_presenter.rb
@@ -19,6 +19,7 @@ class Registrar::DomainListCSVPresenter
def header
columns = %w(
domain_name
+ transfer_code
registrant_name
registrant_code
expire_time
@@ -32,9 +33,10 @@ class Registrar::DomainListCSVPresenter
def domain_to_row(domain:)
row = []
row[0] = domain.name
- row[1] = domain.registrant_name
- row[2] = domain.registrant_code
- row[3] = domain.expire_date
+ row[1] = domain.transfer_code
+ row[2] = domain.registrant_name
+ row[3] = domain.registrant_code
+ row[4] = domain.expire_date
row
CSV::Row.new([], row)
diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml
index 31d8f84e3..0367db3be 100644
--- a/app/views/admin/contact_versions/index.haml
+++ b/app/views/admin/contact_versions/index.haml
@@ -58,7 +58,7 @@
- @versions.each do |version|
- if version
- contact = Contact.new(version.object.to_h)
- - version.object_changes.to_h.each{|k,v| contact[k]=v.last}
+ - version.object_changes.to_h.each { |k,v| contact.public_send("#{k}=", v.last) }
%tr
%td= link_to(contact.name, admin_contact_version_path(version.id))
diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml
index 82a96daba..e19326fca 100644
--- a/app/views/admin/contact_versions/show.haml
+++ b/app/views/admin/contact_versions/show.haml
@@ -1,5 +1,5 @@
- contact = Contact.new(@version.object.to_h)
-- @version.object_changes.to_h.each{|k,v| contact[k]=v.last}
+- @version.object_changes.to_h.each { |k,v| contact.public_send("#{k}=", v.last ) }
= render 'shared/title', name: contact.name
.row
diff --git a/app/views/admin/contacts/_form.haml b/app/views/admin/contacts/_form.haml
index d1538ab4e..2e0553a98 100644
--- a/app/views/admin/contacts/_form.haml
+++ b/app/views/admin/contacts/_form.haml
@@ -3,9 +3,7 @@
= render 'shared/errors', object: contact
.row
.col-md-8
- .tab-content{style:'margin-top: 20px;'}
- #general-tab.tab-pane.active
- = render 'admin/shared/form/statuses', f: f,
+ = render 'admin/shared/form/statuses', f: f,
model: 'contact',
admin_statuses_map: Contact.admin_statuses_map,
disabled_statuses: Contact::STATUSES - Contact.admin_statuses,
diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml
index 2a22284e9..5e6d8eaa9 100644
--- a/app/views/admin/domain_versions/archive.haml
+++ b/app/views/admin/domain_versions/archive.haml
@@ -56,7 +56,7 @@
- @versions.each do |version|
- if version
- domain = Domain.new(version.object.to_h)
- - version.object_changes.to_h.each{|k,v| domain[k]=v.last}
+ - version.object_changes.to_h.each{|k,v| domain.public_send("#{k}=", v.last) }
%tr
%td= link_to(domain.name, admin_domain_version_path(version.id))
@@ -66,7 +66,7 @@
- else
- contact = Contact.all_versions_for([domain.registrant_id], version.created_at).first
- if contact.nil? && ver = ContactVersion.where(item_id: domain.registrant_id).last
- - contact = Contact.new(ver.object.to_h.merge(ver.object_changes.to_h.each_with_object({}){|(k,v), o| o[k]=v.last } ))
+ - contact = Contact.new(ver.object.to_h.merge(ver.object_changes.to_h.each_with_object({}){|(k,v), o| o.public_send("#{k}=", v.last) } ))
= contact.try(:name)
= " ".html_safe
= "(#{t(:deleted)})"
diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml
index d0863eed5..1a17ba3f9 100644
--- a/app/views/admin/domain_versions/show.haml
+++ b/app/views/admin/domain_versions/show.haml
@@ -1,5 +1,5 @@
- domain = Domain.new(@version.object.to_h)
-- @version.object_changes.to_h.each{|k,v| domain[k]=v.last}
+- @version.object_changes.to_h.each{|k,v| domain.public_send("#{k}=", v.last) }
- if @version
- children = HashWithIndifferentAccess.new(@version.children)
diff --git a/app/views/admin/domains/_domain.html.erb b/app/views/admin/domains/_domain.html.erb
new file mode 100644
index 000000000..6431833e6
--- /dev/null
+++ b/app/views/admin/domains/_domain.html.erb
@@ -0,0 +1,6 @@
+
+ <%= link_to domain, admin_domain_path(domain) %> |
+ <%= link_to domain.registrant, admin_registrant_path(domain.registrant) %> |
+ <%= l domain.expire_time %> |
+ <%= link_to domain.registrar, admin_registrar_path(domain.registrar) %> |
+
diff --git a/app/views/admin/domains/_form.haml b/app/views/admin/domains/_form.haml
index 087930c58..93b6be600 100644
--- a/app/views/admin/domains/_form.haml
+++ b/app/views/admin/domains/_form.haml
@@ -4,9 +4,7 @@
%hr
.row
.col-md-8
- .tab-content{style:'margin-top: 20px;'}
- #general-tab.tab-pane.active
- = render 'admin/shared/form/statuses', f: f,
+ = render 'admin/shared/form/statuses', f: f,
model: 'domain',
admin_statuses_map: DomainStatus.admin_statuses_map,
disabled_statuses: DomainStatus::STATUSES - DomainStatus.admin_statuses,
diff --git a/app/views/admin/domains/_search_form.html.erb b/app/views/admin/domains/_search_form.html.erb
new file mode 100644
index 000000000..bc317ea0b
--- /dev/null
+++ b/app/views/admin/domains/_search_form.html.erb
@@ -0,0 +1,70 @@
+<%= search_form_for [:admin, @q], html: { class: 'search-form', autocomplete: 'off' } do |f| %>
+
+
+
+ <%= f.label :name, for: nil %>
+ <%= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name) %>
+
+
+
+
+ <%= f.label :registrant_ident, for: nil %>
+ <%= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident) %>
+
+
+
+
+ <%= f.label :contact_ident, for: nil %>
+ <%= f.search_field :contacts_ident_eq, class: 'form-control', placeholder: t(:contact_ident) %>
+
+
+
+
+ <%= f.label :nameserver_hostname, for: nil %>
+ <%= f.search_field :nameservers_hostname_eq, class: 'form-control', placeholder: t(:nameserver_hostname) %>
+
+
+
+
+
+
+ <%= f.label :registrar_name, for: nil %>
+ <%= f.select :registrar_id_eq, Registrar.all.map { |x| [x, x.id] }, { include_blank: true }, class: 'form-control selectize' %>
+
+
+
+
+ <%= f.label :valid_to_from, for: nil %>
+ <%= f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_from) %>
+
+
+
+
+ <%= f.label :valid_to_until, for: nil %>
+ <%= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_until) %>
+
+
+
+
+
+
+ <%= label_tag :status, nil, for: nil %>
+ <%= select_tag :statuses_contains, options_for_select(DomainStatus::STATUSES, params[:statuses_contains]), { multiple: true, class: 'form-control js-combobox' } %>
+
+
+
+
+ <%= label_tag :results_per_page, nil, for: nil %>
+ <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %>
+
+
+
+
+ <%= link_to t('.reset_btn'), admin_domains_path, class: 'btn btn-default' %>
+
+
+<% end %>
diff --git a/app/views/admin/domains/index.haml b/app/views/admin/domains/index.haml
deleted file mode 100644
index fdc6f64b2..000000000
--- a/app/views/admin/domains/index.haml
+++ /dev/null
@@ -1,81 +0,0 @@
-= render 'shared/title', name: t(:domains)
-
-.row
- .col-md-12
- = search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
- .row
- .col-md-3
- .form-group
- = f.label :name
- = f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name)
- .col-md-3
- .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_name)
- = 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 js-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 js-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
-
- %span.glyphicon.glyphicon-search
-
- = link_to(t('.reset_btn'), admin_domains_path, class: 'btn btn-default')
-%hr
-.row
- .col-md-12
- .table-responsive
- %table.table.table-hover.table-bordered.table-condensed
- %thead
- %tr
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'name')
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'registrant_name', t('.registrant'))
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'valid_to', t(:valid_to))
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'registrar_name', t(:registrar_name))
- %tbody
- - @domains.each do |x|
- %tr
- %td= link_to(x, admin_domain_path(x))
- %td
- - if x.registrant
- = link_to(x.registrant, [:admin, x.registrant])
-
- %td= l(x.valid_to, format: :short)
- %td= link_to(x.registrar, admin_registrar_path(x.registrar)) if x.registrar
-.row
- .col-md-6
- = paginate @domains
- .col-md-6.text-right
- .pagination
- = t(:result_count, count: @domains.total_count)
diff --git a/app/views/admin/domains/index.html.erb b/app/views/admin/domains/index.html.erb
new file mode 100644
index 000000000..605655472
--- /dev/null
+++ b/app/views/admin/domains/index.html.erb
@@ -0,0 +1,42 @@
+
+
+
+
+ <%= render 'search_form' %>
+
+
+
+
+
+
+
+
+
+ <%= sort_link(@q, 'name') %> |
+ <%= sort_link(@q, 'registrant_name', Registrant.model_name.human) %> |
+ <%= sort_link(@q, 'valid_to', t(:valid_to)) %> |
+ <%= sort_link(@q, 'registrar_name', Registrar.model_name.human) %> |
+
+
+
+
+ <%= render @domains %>
+
+
+
+
+
+
+
+
+ <%= paginate @domains %>
+
+
+
+
+
+
diff --git a/app/views/admin/domains/partials/_general.haml b/app/views/admin/domains/partials/_general.haml
deleted file mode 100644
index d64654a8f..000000000
--- a/app/views/admin/domains/partials/_general.haml
+++ /dev/null
@@ -1,32 +0,0 @@
-.panel.panel-default
- .panel-heading
- %h3.panel-title= t(:general)
- .panel-body
- %dl.dl-horizontal
- %dt= t(:name)
- %dd= @domain.name
-
- %dt= t(:registered_at)
- %dd= l(@domain.registered_at)
-
- %dt= t(:registrar_name)
- %dd= link_to(@domain.registrar, admin_registrar_path(@domain.registrar))
-
- %dt= t(:authinfo_pw)
- %dd
- = text_field_tag :password, @domain.auth_info, readonly: true, class: 'partially-hidden'
-
- %dt= t(:valid_from)
- %dd= l(@domain.valid_from)
-
- %dt= t(:valid_to)
- %dd= l(@domain.valid_to)
-
- %dt= t('.outzone_time')
- %dd= l(@domain.outzone_at)
-
- %dt= t('.delete_time')
- %dd= l(@domain.delete_at)
-
- %dt= t('.force_delete_time')
- %dd= l(@domain.force_delete_at)
diff --git a/app/views/admin/domains/partials/_general.html.erb b/app/views/admin/domains/partials/_general.html.erb
new file mode 100644
index 000000000..eeeef6eb5
--- /dev/null
+++ b/app/views/admin/domains/partials/_general.html.erb
@@ -0,0 +1,41 @@
+
+
+
+ <%= t(:general) %>
+
+
+
+
+
+ - <%= t(:name) %>
+ - <%= @domain.name %>
+
+ - <%= t(:registered_at) %>
+ - <%= l(@domain.registered_at) %>
+
+ - <%= t(:registrar_name) %>
+ - <%= link_to(@domain.registrar, admin_registrar_path(@domain.registrar)) %>
+
+ - <%= Domain.human_attribute_name :transfer_code %>
+ -
+ <%= tag :input, type: 'text', value: @domain.transfer_code, readonly: true,
+ class: 'form-control input-sm' %>
+
+
+ - <%= t(:valid_from) %>
+ - <%= l(@domain.valid_from) %>
+
+ - <%= t(:valid_to) %>
+ - <%= l(@domain.valid_to) %>
+
+ - <%= t('.outzone_time') %>
+ - <%= l(@domain.outzone_at) %>
+
+ - <%= t('.delete_time') %>
+ - <%= l(@domain.delete_at) %>
+
+ - <%= t('.force_delete_time') %>
+ - <%= l(@domain.force_delete_at) %>
+
+
+
diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml
index 38c4474e8..b15bda0dd 100644
--- a/app/views/admin/domains/partials/_version.haml
+++ b/app/views/admin/domains/partials/_version.haml
@@ -33,7 +33,7 @@
%td
%p.nowrap
- = l(domain.updated_at, format: :shorts)
+ = l domain.updated_at
-#- if statuses_link
%br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id])
diff --git a/app/views/epp/domains/info.xml.builder b/app/views/epp/domains/info.xml.builder
index ef283ab07..8bf169acd 100644
--- a/app/views/epp/domains/info.xml.builder
+++ b/app/views/epp/domains/info.xml.builder
@@ -55,7 +55,7 @@ xml.epp_head do
if can? :view_password, @domain, @password
xml.tag!('domain:authInfo') do
- xml.tag!('domain:pw', @domain.auth_info)
+ xml.tag!('domain:pw', @domain.transfer_code)
end
end
end
diff --git a/app/views/epp/domains/partials/_transfer.xml.builder b/app/views/epp/domains/partials/_transfer.xml.builder
index 13daf8014..151af28b3 100644
--- a/app/views/epp/domains/partials/_transfer.xml.builder
+++ b/app/views/epp/domains/partials/_transfer.xml.builder
@@ -1,9 +1,9 @@
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:trStatus', dt.status)
- builder.tag!('domain:reID', dt.transfer_to.code)
+ builder.tag!('domain:reID', dt.new_registrar.code)
builder.tag!('domain:reDate', dt.transfer_requested_at.try(:iso8601))
- builder.tag!('domain:acID', dt.transfer_from.code)
+ builder.tag!('domain:acID', dt.old_registrar.code)
builder.tag!('domain:acDate', dt.transferred_at.try(:iso8601) || dt.wait_until.try(:iso8601))
builder.tag!('domain:exDate', dt.domain_valid_to.try(:iso8601))
end
diff --git a/app/views/layouts/registrant/application.haml b/app/views/layouts/registrant/application.haml
index 2eba33ea5..12d161c94 100644
--- a/app/views/layouts/registrant/application.haml
+++ b/app/views/layouts/registrant/application.haml
@@ -2,17 +2,13 @@
%html{lang: I18n.locale.to_s}
%head
%meta{charset: "utf-8"}/
- %meta{content: "IE=edge", "http-equiv" => "X-UA-Compatible"}/
%meta{content: "width=device-width, initial-scale=1", name: "viewport"}/
- %meta{content: "Full stack top-level domain (TLD) management.", name: "description"}/
- %meta{content: "Gitlab LTD", name: "author"}/
- if content_for? :head_title
= yield :head_title
- else
%title= t(:registrant_head_title)
= csrf_meta_tags
- = stylesheet_link_tag 'registrant-manifest', media: 'all', 'data-turbolinks-track' => true
- = javascript_include_tag 'registrant-manifest', 'data-turbolinks-track' => true
+ = stylesheet_link_tag 'registrant-manifest', media: 'all'
= favicon_link_tag 'favicon.ico'
%body
/ Fixed navbar
@@ -49,9 +45,10 @@
%footer.footer
.container
- %row
+ .row
.col-md-6
= image_tag 'eis-logo-et.png'
.col-md-6.text-right
Version
= CURRENT_COMMIT_HASH
+ = javascript_include_tag 'registrant-manifest', async: true
diff --git a/app/views/layouts/registrar/base.haml b/app/views/layouts/registrar/base.haml
deleted file mode 100644
index e0bdd5f24..000000000
--- a/app/views/layouts/registrar/base.haml
+++ /dev/null
@@ -1,44 +0,0 @@
-!!! 5
-%html{lang: I18n.locale.to_s}
- %head
- %meta{charset: "utf-8"}/
- %meta{content: "IE=edge", "http-equiv" => "X-UA-Compatible"}/
- %meta{content: "width=device-width, initial-scale=1", name: "viewport"}/
- - if content_for? :head_title
- = yield :head_title
- - else
- %title= t(:registrar_head_title)
- = csrf_meta_tags
- = stylesheet_link_tag 'registrar-manifest', media: 'all', 'data-turbolinks-track' => true
- = javascript_include_tag 'registrar-manifest', 'data-turbolinks-track' => true
- = favicon_link_tag 'favicon.ico'
- %body
- %nav.navbar.navbar-default.navbar-fixed-top
- .container
- .navbar-header
- %button.navbar-toggle.collapsed{"aria-controls" => "navbar", "aria-expanded" => "false", "data-target" => "#navbar", "data-toggle" => "collapse", :type => "button"}
- %span.sr-only Toggle navigation
- %span.icon-bar
- %span.icon-bar
- %span.icon-bar
- = link_to registrar_root_path, class: 'navbar-brand' do
- = t(:registrar_head_title)
- - if unstable_env.present?
- .text-center
- %small{style: 'color: #0074B3;'}= unstable_env
- = render 'navbar'
-
- .container
- = render 'shared/flash'
- - if depp_controller?
- = render 'registrar/shared/epp_results'
- = yield
-
- %footer.footer
- .container
- .row
- .col-md-6
- = image_tag 'eis-logo-et.png'
- .col-md-6.text-right
- Version
- = CURRENT_COMMIT_HASH
diff --git a/app/views/layouts/registrar/base.html.erb b/app/views/layouts/registrar/base.html.erb
new file mode 100644
index 000000000..6116c7a26
--- /dev/null
+++ b/app/views/layouts/registrar/base.html.erb
@@ -0,0 +1,63 @@
+
+
+
+
+
+ <% if content_for? :head_title %>
+ <%= yield :head_title %>
+ <% else %>
+
+ <%= t(:registrar_head_title) %>
+
+ <% end %>
+ <%= csrf_meta_tags %>
+ <%= stylesheet_link_tag 'registrar-manifest', media: 'all' %>
+ <%= favicon_link_tag 'favicon.ico' %>
+
+
+
+
+ <%= render 'shared/flash' %>
+ <% if depp_controller? %>
+ <%= render 'registrar/shared/epp_results' %>
+ <% end %>
+ <%= yield %>
+
+
+<%= javascript_include_tag 'registrar-manifest', async: true %>
+
+
diff --git a/app/views/registrant/domains/_domain.html.erb b/app/views/registrant/domains/_domain.html.erb
new file mode 100644
index 000000000..b3bf4d334
--- /dev/null
+++ b/app/views/registrant/domains/_domain.html.erb
@@ -0,0 +1,6 @@
+
+ <%= link_to domain, registrant_domain_path(domain) %> |
+ <%= link_to domain.registrant.name, registrant_contact_path(domain.registrant) %> |
+ <%= l domain.expire_time %> |
+ <%= link_to domain.registrar, registrant_registrar_path(domain.registrar) %> |
+
diff --git a/app/views/registrant/domains/index.haml b/app/views/registrant/domains/index.haml
deleted file mode 100644
index 056abd885..000000000
--- a/app/views/registrant/domains/index.haml
+++ /dev/null
@@ -1,84 +0,0 @@
-= render 'shared/title', name: t(:domains)
-
-.row
- .col-md-12
- = search_form_for [:registrant, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
- .row
- .col-md-3
- .form-group
- = f.label :name
- = f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name)
- .col-md-3
- .form-group
- = f.label t(:registrant_ident)
- = f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident)
- .row
- .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 js-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 js-datepicker', placeholder: t(:valid_to_until)
- .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
-
- %span.glyphicon.glyphicon-search
-
- %button.btn.btn-default.js-reset-form
- = t(:clear_fields)
- .row
- .col-md-3
- .btn-group{:role => "group"}
- %button.btn.btn-default.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button"}
- Download
- %span.caret
- %ul.dropdown-menu
- %li= link_to 'PDF', download_list_registrant_domains_path(q: params[:q], format: "pdf")
- %li= link_to 'CSV', download_list_registrant_domains_path(q: params[:q], format: "csv")
- .col-md-3
- .col-md-3
- .col-md-3
-
-
-
-%hr
-.row
- .col-md-12
- .table-responsive
- %table.table.table-hover.table-bordered.table-condensed
- %thead
- %tr
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'name')
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'registrant_name', t('.registrant'))
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'valid_to', t(:valid_to))
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'registrar_name', t(:registrar_name))
- %tbody
- - @domains.each do |x|
- %tr
- %td= link_to(x, registrant_domain_path(x))
- %td= link_to(x.registrant.name, registrant_contact_path(x.registrant)) if x.registrant
- %td= l(x.valid_to, format: :short)
- %td= link_to(x.registrar, registrant_registrar_path(x.registrar)) if x.registrar
-
- .row
- .col-md-6
- = 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 = "#{registrant_domains_path}"
-
diff --git a/app/views/registrant/domains/index.html.erb b/app/views/registrant/domains/index.html.erb
new file mode 100644
index 000000000..43a9122eb
--- /dev/null
+++ b/app/views/registrant/domains/index.html.erb
@@ -0,0 +1,111 @@
+
+
+
+
+ <%= search_form_for [:registrant, @q], html: { class: 'search-form', autocomplete: 'off' } do |f| %>
+
+
+
+ <%= f.label :name, for: nil %>
+ <%= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name) %>
+
+
+
+
+ <%= f.label t(:registrant_ident), for: nil %>
+ <%= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident) %>
+
+
+
+
+
+
+ <%= f.label t(:valid_to_from), for: nil %>
+ <%= f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_from) %>
+
+
+
+
+ <%= f.label t(:valid_to_until), for: nil %>
+ <%= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_until) %>
+
+
+
+
+ <%= label_tag t(:results_per_page) %>
+ <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %>
+
+
+
+
+
+ <%= link_to(t('.reset_btn'), registrant_domains_path, class: 'btn btn-default') %>
+
+
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+ <%= sort_link(@q, 'name') %>
+ |
+
+ <%= sort_link(@q, 'registrant_name', t('.registrant')) %>
+ |
+
+ <%= sort_link(@q, 'valid_to', t(:valid_to)) %>
+ |
+
+ <%= sort_link(@q, 'registrar_name', t(:registrar_name)) %>
+ |
+
+
+
+
+ <%= render @domains %>
+
+
+
+
+
+ <%= paginate @domains %>
+
+
+
+
+
diff --git a/app/views/registrant/domains/partials/_general.haml b/app/views/registrant/domains/partials/_general.haml
deleted file mode 100644
index 7fb355c1f..000000000
--- a/app/views/registrant/domains/partials/_general.haml
+++ /dev/null
@@ -1,32 +0,0 @@
-.panel.panel-default
- .panel-heading
- %h3.panel-title= t(:general)
- .panel-body
- %dl.dl-horizontal
- %dt= t(:name)
- %dd= @domain.name
-
- %dt= t(:registered_at)
- %dd= l(@domain.registered_at)
-
- %dt= t(:registrar_name)
- %dd= link_to(@domain.registrar, registrant_registrar_path(@domain.registrar))
-
- %dt= t(:authinfo_pw)
- %dd
- = text_field_tag :password, @domain.auth_info, readonly: true, class: 'partially-hidden'
-
- %dt= t(:valid_from)
- %dd= l(@domain.valid_from)
-
- %dt= t(:valid_to)
- %dd= l(@domain.valid_to)
-
- %dt= t(:outzone_at)
- %dd= l(@domain.outzone_at)
-
- %dt= t(:delete_at)
- %dd= l(@domain.delete_at)
-
- %dt= t(:force_delete_at)
- %dd= l(@domain.force_delete_at)
diff --git a/app/views/registrant/domains/partials/_general.html.erb b/app/views/registrant/domains/partials/_general.html.erb
new file mode 100644
index 000000000..72ae8aad7
--- /dev/null
+++ b/app/views/registrant/domains/partials/_general.html.erb
@@ -0,0 +1,41 @@
+
+
+
+ <%= t(:general) %>
+
+
+
+
+
+ - <%= t(:name) %>
+ - <%= @domain.name %>
+
+ - <%= t(:registered_at) %>
+ - <%= l(@domain.registered_at) %>
+
+ - <%= t(:registrar_name) %>
+ - <%= link_to(@domain.registrar, registrant_registrar_path(@domain.registrar)) %>
+
+ - <%= Domain.human_attribute_name :transfer_code %>
+ -
+ <%= tag :input, type: 'text', value: @domain.transfer_code, readonly: true,
+ class: 'form-control input-sm' %>
+
+
+ - <%= t(:valid_from) %>
+ - <%= l(@domain.valid_from) %>
+
+ - <%= t(:valid_to) %>
+ - <%= l(@domain.valid_to) %>
+
+ - <%= t(:outzone_at) %>
+ - <%= l(@domain.outzone_at) %>
+
+ - <%= t(:delete_at) %>
+ - <%= l(@domain.delete_at) %>
+
+ - <%= t(:force_delete_at) %>
+ - <%= l(@domain.force_delete_at) %>
+
+
+
diff --git a/app/views/registrant/domains/show.haml b/app/views/registrant/domains/show.haml
deleted file mode 100644
index 4d524b785..000000000
--- a/app/views/registrant/domains/show.haml
+++ /dev/null
@@ -1,17 +0,0 @@
-= render 'shared/title', name: @domain.name
-
-.row
- .col-md-6= render 'registrant/domains/partials/general'
- .col-md-6= render 'registrant/domains/partials/owner'
-.row
- .col-md-12= render 'registrant/domains/partials/tech_contacts'
-.row
- .col-md-12= render 'registrant/domains/partials/admin_contacts'
-.row
- .col-md-12= render 'registrant/domains/partials/statuses'
-.row
- .col-md-12= render 'registrant/domains/partials/nameservers'
-.row
- .col-md-12= render 'registrant/domains/partials/dnskeys'
-.row
- .col-md-12= render 'registrant/domains/partials/keyrelays'
diff --git a/app/views/registrant/domains/show.html.erb b/app/views/registrant/domains/show.html.erb
new file mode 100644
index 000000000..32dc2584a
--- /dev/null
+++ b/app/views/registrant/domains/show.html.erb
@@ -0,0 +1,46 @@
+<%= render 'shared/title', name: @domain.name %>
+
+
+
+ <%= render 'registrant/domains/partials/general' %>
+
+
+ <%= render 'registrant/domains/partials/owner' %>
+
+
+
+
+
+ <%= render 'registrant/domains/partials/tech_contacts' %>
+
+
+
+
+
+ <%= render 'registrant/domains/partials/admin_contacts' %>
+
+
+
+
+
+ <%= render 'registrant/domains/partials/statuses' %>
+
+
+
+
+
+ <%= render 'registrant/domains/partials/nameservers' %>
+
+
+
+
+
+ <%= render 'registrant/domains/partials/dnskeys' %>
+
+
+
+
+
+ <%= render 'registrant/domains/partials/keyrelays' %>
+
+
diff --git a/app/views/registrant/sessions/login_mid.haml b/app/views/registrant/sessions/login_mid.haml
index ad088dafd..34da5a2ae 100644
--- a/app/views/registrant/sessions/login_mid.haml
+++ b/app/views/registrant/sessions/login_mid.haml
@@ -12,7 +12,8 @@
%div.text-center
00007, 60000007, 00000766
- :coffee
+:coffee
+ load_listener = ->
$('.js-login').attr('disabled', false)
status_interval = null
@@ -37,4 +38,4 @@
flash_alert(data.responseJSON.message)
$('.js-login').attr('disabled', false)
)
-
+ window.addEventListener 'load', load_listener
diff --git a/app/views/registrar/account_activities/index.haml b/app/views/registrar/account_activities/index.haml
index 4d8f2ff19..857f117d0 100644
--- a/app/views/registrar/account_activities/index.haml
+++ b/app/views/registrar/account_activities/index.haml
@@ -30,8 +30,7 @@
%span.glyphicon.glyphicon-search
- %button.btn.btn-default.js-reset-form
- = t(:clear_fields)
+ = link_to(t('.reset_btn'), registrar_account_activities_path, class: 'btn btn-default')
%hr
.row
@@ -60,8 +59,3 @@
.row
.col-md-12
= paginate @account_activities
-
-:coffee
- $(".js-reset-form").on "click", (e) ->
- e.preventDefault();
- window.location = "#{registrar_account_activities_path}"
diff --git a/app/views/registrar/contacts/index.haml b/app/views/registrar/contacts/index.haml
index 5f5a667c0..518e6eccf 100644
--- a/app/views/registrar/contacts/index.haml
+++ b/app/views/registrar/contacts/index.haml
@@ -66,8 +66,7 @@
%span.glyphicon.glyphicon-search
- %button.btn.btn-default.js-reset-form
- = t(:clear_fields)
+ = link_to(t('.reset_btn'), registrar_contacts_path, class: 'btn btn-default')
.row
.col-md-3
.btn-group{:role => "group"}
@@ -119,8 +118,3 @@
.col-md-6.text-right
.pagination
= t(:result_count, count: @contacts.total_count)
-
-:coffee
- $(".js-reset-form").on "click", (e) ->
- e.preventDefault();
- window.location = "#{registrar_contacts_path}"
diff --git a/app/views/registrar/domain_transfers/create.html.erb b/app/views/registrar/domain_transfers/create.html.erb
new file mode 100644
index 000000000..bf258e476
--- /dev/null
+++ b/app/views/registrar/domain_transfers/create.html.erb
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+ <%= t(:result) %>
+
+
+
+
+ - <%= t(:domain_name) %>
+ - <%= @data.css('name').text %>
+
+ <% @data.css('trnData').children.each do |x| %>
+ <% next if x.blank? %>
+ - <%= t(x.name) %>
+ - <%= x.text %>
+ <% end %>
+
+
+
+
+
diff --git a/app/views/registrar/domain_transfers/form/_api_errors.html.erb b/app/views/registrar/domain_transfers/form/_api_errors.html.erb
new file mode 100644
index 000000000..56bf8c404
--- /dev/null
+++ b/app/views/registrar/domain_transfers/form/_api_errors.html.erb
@@ -0,0 +1,9 @@
+<% if @api_errors %>
+
+
+ <% @api_errors.each do |error| %>
+ - <%= error[:title] %>
+ <% end %>
+
+
+<% end %>
diff --git a/app/views/registrar/domain_transfers/form/_batch.html.erb b/app/views/registrar/domain_transfers/form/_batch.html.erb
new file mode 100644
index 000000000..6effa8a86
--- /dev/null
+++ b/app/views/registrar/domain_transfers/form/_batch.html.erb
@@ -0,0 +1,19 @@
+<%= form_tag registrar_domain_transfers_path, multipart: true, class: 'form-horizontal' do %>
+
+
+
+<% end %>
diff --git a/app/views/registrar/domain_transfers/form/_single.html.erb b/app/views/registrar/domain_transfers/form/_single.html.erb
new file mode 100644
index 000000000..8a9488580
--- /dev/null
+++ b/app/views/registrar/domain_transfers/form/_single.html.erb
@@ -0,0 +1,37 @@
+<%= form_tag registrar_domain_transfers_path, multipart: true, class: 'form-horizontal' do %>
+
+
+
+
+
+
+
+<% end %>
diff --git a/app/views/registrar/domain_transfers/new.html.erb b/app/views/registrar/domain_transfers/new.html.erb
new file mode 100644
index 000000000..8ba658023
--- /dev/null
+++ b/app/views/registrar/domain_transfers/new.html.erb
@@ -0,0 +1,29 @@
+
+
+<%= render 'registrar/domain_transfers/form/api_errors' %>
+
+
+
+
+
+
+
+ <%= render 'registrar/domain_transfers/form/single' %>
+
+
+
+ <%= render 'registrar/domain_transfers/form/batch' %>
+
+
+
+
diff --git a/app/views/registrar/domains/_domain.html.erb b/app/views/registrar/domains/_domain.html.erb
new file mode 100644
index 000000000..74f29dc15
--- /dev/null
+++ b/app/views/registrar/domains/_domain.html.erb
@@ -0,0 +1,13 @@
+
+ <%= link_to truncate(domain.name), info_registrar_domains_path(domain_name: domain.name) %> |
+ <%= link_to domain.registrant, registrar_contact_path(id: domain.registrant.code) %> |
+ <%= l domain.expire_time %> |
+
+ <%= link_to t('.edit_btn'), edit_registrar_domains_path(domain_name: domain.name),
+ class: 'btn btn-primary btn-xs' %>
+ <%= link_to t('.renew_btn'), renew_registrar_domains_path(domain_name: domain.name),
+ class: 'btn btn-default btn-xs' %>
+ <%= link_to t('.delete_btn'), delete_registrar_domains_path(domain_name: domain.name),
+ class: 'btn btn-default btn-xs' %>
+ |
+
diff --git a/app/views/registrar/domains/_search_form.html.erb b/app/views/registrar/domains/_search_form.html.erb
new file mode 100644
index 000000000..b494e0d8d
--- /dev/null
+++ b/app/views/registrar/domains/_search_form.html.erb
@@ -0,0 +1,88 @@
+<%= search_form_for [:registrar, @q], html: { class: 'search-form', autocomplete: 'off' } do |f| %>
+
+
+
+ <%= f.label :name, for: nil %>
+ <%= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control',
+ placeholder: t(:name) %>
+
+
+
+
+
+ <%= f.label :registrant_ident, for: nil %>
+ <%= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident) %>
+
+
+
+
+
+ <%= f.label :contact_ident, for: nil %>
+ <%= f.search_field :contacts_ident_eq, class: 'form-control', placeholder: t(:contact_ident) %>
+
+
+
+
+
+ <%= f.label :nameserver_hostname, for: nil %>
+ <%= f.search_field :nameservers_hostname_eq, class: 'form-control',
+ placeholder: t(:nameserver_hostname) %>
+
+
+
+
+
+
+
+ <%= label_tag :status, nil, for: nil %>
+ <%= select_tag :statuses_contains,
+ options_for_select(DomainStatus::STATUSES, params[:statuses_contains]),
+ { multiple: true, class: 'form-control js-combobox' } %>
+
+
+
+
+
+ <%= f.label :valid_to_from, for: nil %>
+ <%= f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq],
+ class: 'form-control js-datepicker',
+ placeholder: t(:valid_to_from) %>
+
+
+
+
+
+ <%= f.label :valid_to_until, for: nil %>
+ <%= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq],
+ class: 'form-control js-datepicker',
+ placeholder: t(:valid_to_until) %>
+
+
+
+
+
+
+ <%= label_tag :results_per_page, nil, for: nil %>
+
+
+
+
+
+
+ <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control',
+ placeholder: t(:results_per_page) %>
+
+
+
+
+
+ <%= button_tag t('.download_btn'), class: 'btn btn-primary export-domains-csv-btn',
+ formaction: registrar_domains_path(format: 'csv') %>
+ <%= link_to t('.reset_btn'), registrar_domains_path, class: 'btn btn-default' %>
+
+
+<% end %>
diff --git a/app/views/registrar/domains/form/_contacts.haml b/app/views/registrar/domains/form/_contacts.haml
index 931f206b5..8e01ffda3 100644
--- a/app/views/registrar/domains/form/_contacts.haml
+++ b/app/views/registrar/domains/form/_contacts.haml
@@ -22,21 +22,23 @@
= text_field_tag "domain[contacts_attributes][#{k}][code_helper]", contacts.find_by(code: v['code']).try(:search_name), class: 'form-control', data: {autocomplete: search_contacts_registrar_domains_path}, required: true
:coffee
- clone = $('.js-contact:first').clone()
- $("#js-domain-contacts").nestedAttributes
- bindAddTo: $(".add-domain-contact")
- afterAdd: (item) ->
- # preselect type
- item.find('select.js-contact-type').each (k, v) ->
- $(v).val($(v).find('option:last-child').val())
- # add combobex
- item.find('select.js-contact-code').each (k, v) ->
- $(v).select2
- width: "100%"
- selectOnBlur: true
- dropdownAutoWidth: if self==top then true else false
- # remove link for temp
- item.find('a.add-domain-contact').each (k, v) ->
- $(v).hide()
- new Autocomplete()
- $clone: clone
+ load_listener = ->
+ clone = $('.js-contact:first').clone()
+ $("#js-domain-contacts").nestedAttributes
+ bindAddTo: $(".add-domain-contact")
+ afterAdd: (item) ->
+ # preselect type
+ item.find('select.js-contact-type').each (k, v) ->
+ $(v).val($(v).find('option:last-child').val())
+ # add combobex
+ item.find('select.js-contact-code').each (k, v) ->
+ $(v).select2
+ width: "100%"
+ selectOnBlur: true
+ dropdownAutoWidth: if self==top then true else false
+ # remove link for temp
+ item.find('a.add-domain-contact').each (k, v) ->
+ $(v).hide()
+ new Autocomplete()
+ $clone: clone
+ window.addEventListener 'load', load_listener
diff --git a/app/views/registrar/domains/form/_dnskeys.haml b/app/views/registrar/domains/form/_dnskeys.haml
index 7d41682f6..630e16303 100644
--- a/app/views/registrar/domains/form/_dnskeys.haml
+++ b/app/views/registrar/domains/form/_dnskeys.haml
@@ -68,10 +68,10 @@
class: 'form-control'
:coffee
- $("#dnskeys").nestedAttributes
- bindAddTo: $(".add-dnskey")
- afterAdd: (item) ->
- item.find('select').each (k, v) ->
- $(v).val($(v).find('option:first-child').val())
-
-
+ load_listener = ->
+ $("#dnskeys").nestedAttributes
+ bindAddTo: $(".add-dnskey")
+ afterAdd: (item) ->
+ item.find('select').each (k, v) ->
+ $(v).val($(v).find('option:first-child').val())
+ window.addEventListener 'load', load_listener
diff --git a/app/views/registrar/domains/form/_nameservers.haml b/app/views/registrar/domains/form/_nameservers.haml
index 572821c6c..75d34b924 100644
--- a/app/views/registrar/domains/form/_nameservers.haml
+++ b/app/views/registrar/domains/form/_nameservers.haml
@@ -27,5 +27,7 @@
= text_field_tag "domain[nameservers_attributes][#{k}][ipv6]", v['ipv6'],
class: 'form-control'#, ipv6: true
:coffee
- $("#nameservers").nestedAttributes
- bindAddTo: $(".add-nameserver")
+ load_listener = ->
+ $("#nameservers").nestedAttributes
+ bindAddTo: $(".add-nameserver")
+ window.addEventListener 'load', load_listener
diff --git a/app/views/registrar/domains/index.haml b/app/views/registrar/domains/index.haml
deleted file mode 100644
index 3bcda214f..000000000
--- a/app/views/registrar/domains/index.haml
+++ /dev/null
@@ -1,99 +0,0 @@
-- content_for :actions do
- = link_to(t(:new), new_registrar_domain_path, class: 'btn btn-primary')
- = link_to(t(:transfer), transfer_registrar_domains_path, class: 'btn btn-default')
- -# turned off requested by client
- -# = link_to(t(:keyrelay), registrar_keyrelay_path, class: 'btn btn-default')
- -# = link_to(t(:nameservers), registrar_nameservers_path, class: 'btn btn-default')
-= render 'shared/title', name: t(:domains)
-
-.row
- .col-md-12
- = search_form_for [:registrar, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
- .row
- .col-md-3
- .form-group
- = f.label :name
- = f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name)
- .col-md-3
- .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
- = 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
- = f.label t(:valid_to_from)
- = f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq], class: 'form-control js-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 js-datepicker', placeholder: t(:valid_to_until)
- .row
- .col-md-6
- .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.search
-
- %span.glyphicon.glyphicon-search
-
- %button.btn.btn-default.js-reset-form
- = t(:clear_fields)
- .row
- .col-md-2
- = button_tag t('.download_btn'), class: 'btn btn-primary export-domains-csv-btn',
- formaction: registrar_domains_path(format: 'csv')
-%hr
-
-.row
- .col-md-12
- .table-responsive
- %table.table.table-hover.table-bordered.table-condensed
- %thead
- %tr
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'name')
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'registrant_name', t('.registrant'))
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'valid_to', t(:valid_to))
- %th{class: 'col-xs-2'}= t('actions')
- %tbody
- - @domains.each do |x|
- %tr
- %td= link_to(truncate(x.name), info_registrar_domains_path(domain_name: x.name))
- %td
- - if x.registrant
- = link_to(x.registrant, registrar_contact_path(id: x.registrant.code))
- %td= l(x.valid_to, format: :date_long)
- %td
- = link_to(t(:edit), edit_registrar_domains_path(domain_name: x.name),
- class: 'btn btn-primary btn-xs')
- = link_to(t(:renew), renew_registrar_domains_path(domain_name: x.name),
- class: 'btn btn-default btn-xs')
- = link_to(t(:delete), delete_registrar_domains_path(domain_name: x.name),
- class: 'btn btn-default btn-xs')
-.row
- .col-md-6
- = 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 = "#{registrar_domains_path}"
diff --git a/app/views/registrar/domains/index.html.erb b/app/views/registrar/domains/index.html.erb
new file mode 100644
index 000000000..a62619ca4
--- /dev/null
+++ b/app/views/registrar/domains/index.html.erb
@@ -0,0 +1,57 @@
+
+
+
+
+ <%= render 'search_form' %>
+
+
+
+
+
+
+
+
+
+
+ <%= sort_link(@q, 'name') %>
+ |
+
+ <%= sort_link @q, 'registrant_name', Registrant.model_name.human %>
+ |
+
+ <%= sort_link @q, 'valid_to', Domain.human_attribute_name(:expire_time) %>
+ |
+ |
+
+
+
+
+ <%= render @domains %>
+
+
+
+
+
+
+
+
+ <%= paginate @domains %>
+
+
+
+
+
+
diff --git a/app/views/registrar/domains/info.haml b/app/views/registrar/domains/info.haml
deleted file mode 100644
index e794382ed..000000000
--- a/app/views/registrar/domains/info.haml
+++ /dev/null
@@ -1,30 +0,0 @@
-- content_for :actions do
- - if @data.css('pw').text.present?
- = link_to(t(:edit), edit_registrar_domains_path(domain_name: params[:domain_name]),
- class: 'btn btn-default')
- = link_to(t(:renew), renew_registrar_domains_path(domain_name: params[:domain_name]),
- class: 'btn btn-default')
- = link_to(t(:delete), delete_registrar_domains_path(domain_name: params[:domain_name]),
- class: 'btn btn-default')
- - else
- = link_to(t(:transfer), transfer_registrar_domains_path(domain_name: params[:domain_name]),
- class: 'btn btn-default')
-= render 'shared/title', name: truncate(@data.css('name').text)
-
-.row
- .col-sm-12
- - if @data.css('result').first['code'] == '1000'
- .row
- .col-md-12= render 'registrar/domains/partials/general'
- .row
- .col-md-12= render 'registrar/domains/partials/contacts'
- .row
- .col-md-12= render 'registrar/domains/partials/statuses'
- .row
- .col-md-12= render 'registrar/domains/partials/nameservers'
- .row
- .col-md-12= render 'registrar/domains/partials/dnskeys'
- - else
- .row
- .col-sm-6
- %h1= t(:not_found)
diff --git a/app/views/registrar/domains/info.html.erb b/app/views/registrar/domains/info.html.erb
new file mode 100644
index 000000000..1fcfc23c3
--- /dev/null
+++ b/app/views/registrar/domains/info.html.erb
@@ -0,0 +1,53 @@
+<% content_for :actions do %>
+ <% if @data.css('pw').text.present? %>
+ <%= link_to(t(:edit), edit_registrar_domains_path(domain_name: params[:domain_name]),
+ class: 'btn btn-default') %>
+ <%= link_to(t(:renew), renew_registrar_domains_path(domain_name: params[:domain_name]),
+ class: 'btn btn-default') %>
+ <%= link_to(t(:delete), delete_registrar_domains_path(domain_name: params[:domain_name]),
+ class: 'btn btn-default') %>
+ <% else %>
+ <%= link_to t('.transfer_btn'), new_registrar_domain_transfer_path(domain_name: params[:domain_name]),
+ class: 'btn btn-default' %>
+ <% end %>
+<% end %>
+<%= render 'shared/title', name: truncate(@data.css('name').text) %>
+
+
+ <% if @data.css('result').first['code'] == '1000' %>
+
+
+ <%= render 'registrar/domains/partials/general' %>
+
+
+
+
+ <%= render 'registrar/domains/partials/contacts' %>
+
+
+
+
+ <%= render 'registrar/domains/partials/statuses' %>
+
+
+
+
+ <%= render 'registrar/domains/partials/nameservers' %>
+
+
+
+
+ <%= render 'registrar/domains/partials/dnskeys' %>
+
+
+ <% else %>
+
+
+
+ <%= t(:not_found) %>
+
+
+
+ <% end %>
+
+
diff --git a/app/views/registrar/domains/partials/_general.haml b/app/views/registrar/domains/partials/_general.haml
deleted file mode 100644
index db06b3376..000000000
--- a/app/views/registrar/domains/partials/_general.haml
+++ /dev/null
@@ -1,27 +0,0 @@
-.panel.panel-default
- .panel-heading
- %h3.panel-title= t(:general)
- .panel-body
- %dl.dl-horizontal
- %dt= t(:authinfo_pw)
- %dd= @data.css('pw').text.present? ? @data.css('pw').text : t('hidden')
-
- - if @data.css('pw').text.blank?
- %dt= t(:registrar_name)
- %dd= @data.css('clID').text
-
- - registrant = Contact.find_by_code(@data.css('registrant').text)
- %dt= t('.registrant')
- %dd= "#{registrant.name} (#{@data.css('registrant').text})"
-
- %dt= t('.registered')
- %dd= @data.css('crDate').text
-
- %dt= t(:valid_to)
- %dd= @data.css('exDate').text
-
- %dt= t('.created')
- %dd= @data.css('crDate').text
-
- %dt= t('.updated')
- %dd= @data.css('upDate').text
diff --git a/app/views/registrar/domains/partials/_general.html.erb b/app/views/registrar/domains/partials/_general.html.erb
new file mode 100644
index 000000000..3fb3a5df8
--- /dev/null
+++ b/app/views/registrar/domains/partials/_general.html.erb
@@ -0,0 +1,41 @@
+
+
+
+ <%= t(:general) %>
+
+
+
+
+
+ - <%= Domain.human_attribute_name :transfer_code %>
+ -
+ <% if @data.css('pw').text.present? %>
+ <%= tag(:input, type: 'text', value: @data.css('pw').text, readonly: true,
+ class: 'form-control input-sm') %>
+ <% end %>
+
+
+
+ <% if @data.css('pw').text.blank? %>
+ - <%= t(:registrar_name) %>
+ - <%= @data.css('clID').text %>
+ <% end %>
+
+ <% registrant = Contact.find_by_code(@data.css('registrant').text) %>
+ - <%= t('.registrant') %>
+ - <%= "#{registrant.name} (#{@data.css('registrant').text})" %>
+
+ - <%= t('.registered') %>
+ - <%= @data.css('crDate').text %>
+
+ - <%= t(:valid_to) %>
+ - <%= @data.css('exDate').text %>
+
+ - <%= t('.created') %>
+ - <%= @data.css('crDate').text %>
+
+ - <%= t('.updated') %>
+ - <%= @data.css('upDate').text %>
+
+
+
diff --git a/app/views/registrar/domains/transfer.haml b/app/views/registrar/domains/transfer.haml
deleted file mode 100644
index b5a8f438f..000000000
--- a/app/views/registrar/domains/transfer.haml
+++ /dev/null
@@ -1,16 +0,0 @@
-= render 'shared/title', name: t(:transfer_domain)
-
-.row
- .col-md-12
- .panel.panel-default
- .panel-heading
- %h3.panel-title= t(:result)
- .panel-body
- %dl.dl-horizontal
- %dt= t(:domain_name)
- %dd= @data.css('name').text
-
- - @data.css('trnData').children.each do |x|
- - next if x.blank?
- %dt= t(x.name)
- %dd= x.text
diff --git a/app/views/registrar/domains/transfer_index.haml b/app/views/registrar/domains/transfer_index.haml
deleted file mode 100644
index 502a3aab8..000000000
--- a/app/views/registrar/domains/transfer_index.haml
+++ /dev/null
@@ -1,27 +0,0 @@
-= render 'shared/title', name: t(:transfer_domain)
-
-.row
- .col-md-8
- = form_tag transfer_registrar_domains_path, class: 'form-horizontal', method: :post, multipart: true, autocomplete: 'off' do
- .form-group
- .col-md-3.control-label
- = label_tag :domain_name, t(:name), class: 'required'
- .col-md-7
- = text_field_tag :domain_name, params[:domain_name], class: 'form-control',
- placeholder: t(:domain_name), autocomplete: 'off', autofocus: true, required: true
- .form-group
- .col-md-3.control-label
- = label_tag :password, t(:password), class: 'required'
- .col-md-7
- = text_field_tag :password, params[:password],
- class: 'form-control', autocomplete: 'off', required: true
- .form-group
- .col-md-3.control-label
- = label_tag 'legal_document', t(:legal_document)
- .col-md-7
- = file_field_tag 'legal_document'
- .form-group
- .col-md-10.text-right
- %button.btn.btn-warning{ name: 'request' }= t(:transfer)
- /%button.btn.btn-warning{ name: 'approve' }= t(:approve)
- /%button.btn.btn-warning{ name: 'reject' }= t(:reject)
diff --git a/app/views/registrar/invoices/index.haml b/app/views/registrar/invoices/index.haml
index 64236d49d..b8c825c36 100644
--- a/app/views/registrar/invoices/index.haml
+++ b/app/views/registrar/invoices/index.haml
@@ -43,8 +43,7 @@
%span.glyphicon.glyphicon-search
- %button.btn.btn-default.js-reset-form
- = t(:clear_fields)
+ = link_to(t('.reset_btn'), registrar_invoices_path, class: 'btn btn-default')
%hr
.row
.col-md-12
@@ -72,9 +71,3 @@
.row
.col-md-12
= paginate @invoices
-
-:coffee
- $(".js-reset-form").on "click", (e) ->
- e.preventDefault();
- window.location = "#{registrar_invoices_path}"
-
diff --git a/app/views/registrar/payments/pay.html.haml b/app/views/registrar/payments/pay.html.haml
index 62f5fb87a..c0fd8b6ad 100644
--- a/app/views/registrar/payments/pay.html.haml
+++ b/app/views/registrar/payments/pay.html.haml
@@ -6,5 +6,6 @@
:coffeescript
- $(document).ready ->
- $('.payment-form form').submit()
\ No newline at end of file
+ load_listener = ->
+ $('.payment-form form').submit()
+ window.addEventListener 'load', load_listener
diff --git a/app/views/registrar/polls/show.haml b/app/views/registrar/polls/show.haml
index e013bad7b..69e74751b 100644
--- a/app/views/registrar/polls/show.haml
+++ b/app/views/registrar/polls/show.haml
@@ -82,8 +82,10 @@
%p.bg-info{style: 'padding: 15px;'}= t(:you_have_no_new_messages)
:coffee
- $(".js-keyrelay-confirm").on "click", ->
- $(".js-keyrelay-form").submit()
+ load_listener = ->
+ $(".js-keyrelay-confirm").on "click", ->
+ $(".js-keyrelay-form").submit()
- $(".js-transfer-confirm").on "click", ->
- $(".js-transfer-form").submit()
+ $(".js-transfer-confirm").on "click", ->
+ $(".js-transfer-form").submit()
+ window.addEventListener 'load', load_listener
diff --git a/app/views/registrar/sessions/login_mid.haml b/app/views/registrar/sessions/login_mid.haml
index eeb18402d..78e39a3b7 100644
--- a/app/views/registrar/sessions/login_mid.haml
+++ b/app/views/registrar/sessions/login_mid.haml
@@ -12,7 +12,8 @@
%div.text-center
00007, 60000007, 00000766
- :coffee
+:coffee
+ load_listener = ->
$('.js-login').attr('disabled', false)
status_interval = null
@@ -37,4 +38,4 @@
flash_alert(data.responseJSON.message)
$('.js-login').attr('disabled', false)
)
-
+ window.addEventListener 'load', load_listener
diff --git a/app/views/registrar/shared/_nav.haml b/app/views/registrar/shared/_nav.haml
deleted file mode 100644
index d85a17de3..000000000
--- a/app/views/registrar/shared/_nav.haml
+++ /dev/null
@@ -1,13 +0,0 @@
-- content_for :tabs do
- .container.subnav
- %ul.nav.nav-tabs.navbar-right
- %li{role: :presentation, class: active == :domains ? 'active' : ''}
- = link_to t(:all), registrar_domains_path
- %li{role: :presentation, class: active == :new ? 'active' : ''}
- = link_to t(:new), new_registrar_domain_path
- %li{role: :presentation, class: active == :check ? 'active' : ''}
- = link_to t(:check), check_registrar_domains_path
- %li{role: :presentation, class: active == :transfer ? 'active' : ''}
- = link_to t(:transfer), transfer_registrar_domains_path
- %li{role: :presentation, class: active == :keyrelay ? 'active' : ''}
- = link_to t(:keyrelay), registrar_keyrelay_path
diff --git a/app/views/registrar/xml_consoles/show.haml b/app/views/registrar/xml_consoles/show.haml
index 4b07f6aec..f96b67738 100644
--- a/app/views/registrar/xml_consoles/show.haml
+++ b/app/views/registrar/xml_consoles/show.haml
@@ -61,8 +61,10 @@
= CodeRay.scan(@result.to_s.force_encoding("UTF-8"), :xml).div().html_safe
:javascript
+ window.addEventListener('load',
+ function(){
$('.js-load-xml').click(function() {
$.get('xml_console/load_xml', {obj: $(this).data('obj'), epp_action: $(this).data('epp-action')}, function(data) {
$('textarea[name="payload"]').html(data);
});
- });
+ });});
diff --git a/config/locales/admin/domains.en.yml b/config/locales/admin/domains.en.yml
index 26b85c9bb..be26a5542 100644
--- a/config/locales/admin/domains.en.yml
+++ b/config/locales/admin/domains.en.yml
@@ -2,9 +2,12 @@ en:
admin:
domains:
index:
- reset_btn: Reset
+ header: Domains
registrant: Registrant
+ search_form:
+ reset_btn: Reset
+
edit:
add_new_status_btn: Add new status
back_btn: Back to domain
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 0a4a83c98..da6df608a 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -22,10 +22,9 @@ en:
longer: "%a, %e. %b %Y, %H:%M"
long: "%A, %e. %B %Y, %H:%M"
short: "%d.%m.%y, %H:%M"
- shorts: "%d.%m.%y, %H:%M:%S"
date: "%Y-%m-%d"
date_long: "%d. %B %Y"
- ydate: "%Y.%m.%d"
+ filename: "%Y-%m-%d_%H.%M"
date:
formats:
default: "%Y-%m-%d"
@@ -79,7 +78,7 @@ en:
period:
not_a_number: 'Period is not a number'
not_an_integer: 'Period must be an integer'
- auth_info:
+ transfer_code:
wrong_pw: 'Authorization error'
domain_statuses:
invalid: 'Statuses are invalid'
@@ -97,11 +96,6 @@ en:
domain:
<<: *epp_domain_ar_attributes
- domain_transfer:
- attributes:
- base:
- transfer_can_be_approved_only_by_current_registrar: 'Transfer can be approved only by current domain registrar'
-
nameserver:
attributes:
hostname:
@@ -326,32 +320,13 @@ en:
starting_balance: 'Starting balance'
destroyed: 'Destroyed'
- domain_transfer_requested: 'Domain transfer requested!'
- domain_transfer_approved: 'Domain transfer approved!'
- failed_to_approve_domain_transfer: 'Failed to approve domain transfer'
approve: 'Approve'
domain_already_belongs_to_the_querying_registrar: 'Domain already belongs to the querying registrar'
- other_registrar_has_already_requested_to_transfer_this_domain: 'Other registrar has already requested to transfer this domain.'
- transfer_domain: 'Transfer domain'
- failed_to_request_domain_transfer: 'Failed to request domain transfer' #not used atm
- domain_transfer: 'Domain transfer'
- request_domain_transfer: 'Request domain transfer'
- domain_valid_to: 'Domain valid to'
- accept_time: 'Accept time'
- transfer_from: 'Transfer from'
- transferred_at: 'Transferred at'
- domain_transfers_list: 'Domain transfers list'
- domain_transfers: 'Domain transfers'
- password_invalid: 'Password invalid!'
- domain_was_not_found: 'Domain was not found!'
- domain_list: 'Domain list'
- create_new_domain: 'Create new domain'
welcome: 'Welcome!'
edit_statuses: 'Edit statuses'
contact_list: 'Contact list'
create_new_contact: 'Create new contact'
- domain_pw: 'Domain password'
history: 'History'
new_registrar: 'New registrar'
@@ -421,7 +396,6 @@ en:
tech_contacts_min_count: 'Tech contacts minimum count'
tech_contacts_max_count: 'Tech contacts maximum count'
action_failed_due_to_server_error: 'Action failed due to server error'
- pending_transfer_was_not_found: 'Pending transfer was not found'
transfer_can_be_rejected_only_by_current_registrar: 'Transfer can be rejected only by current registrar'
request_command: 'Request command'
request_object: 'Request object'
@@ -441,7 +415,6 @@ en:
attribute_is_invalid: 'Attribute is invalid: %{attribute}'
request_successful: 'Request successful'
choose: 'Choose...'
- clear_fields: 'Clear fields'
created_before: 'Created before'
created_after: 'Created after'
billing_address: 'Billing address'
@@ -500,12 +473,9 @@ en:
blank: "Password can't be blank"
username: 'Username'
- password: 'Password'
- authinfo_pw: 'AuthInfo pw'
log_in: 'Log in'
domains: 'Domains'
register: 'Register'
- check: 'Check'
contacts: 'Contacts'
domain_info: 'Domain info'
domain_details: 'Domain details'
@@ -548,9 +518,7 @@ en:
new: New
renew_domain: 'Renew domain'
cur_exp_date: 'curExpDate'
- transfer: 'Transfer'
query: 'Query'
- transfer_domain: 'Transfer domain'
reject: 'Reject'
approve: 'Approve'
contact_info: 'Contact info'
@@ -806,7 +774,6 @@ en:
manage: Manage
pending_epp: Pending epp
id: ID
- hidden: '[hidden]'
created_at_from: 'Created at from'
created_at_until: 'Created at until'
is_registrant: 'Is registrant'
@@ -817,9 +784,6 @@ en:
contact_is_not_valid: 'Contact %{value} is not valid, please fix the invalid contact'
welcome_to_eis_registrar_portal: 'Welcome to EIS Registrar portal'
interfaces: 'Interfaces'
- list_format_is_in_yaml: 'List format is in YAML'
- if_auth_info_is_left_empty_it_will_be_auto_generated: 'If auth info is left empty, it will be auto generated.'
- each_domain_name_must_end_with_colon_sign: 'Each domain name must end with colon (:) sign.'
next: 'Next'
previous: 'Previous'
personal_domain_verification_url: 'Personal domain verification url'
diff --git a/config/locales/registrant/domains.en.yml b/config/locales/registrant/domains.en.yml
index efbe514e5..be0a1c638 100644
--- a/config/locales/registrant/domains.en.yml
+++ b/config/locales/registrant/domains.en.yml
@@ -2,7 +2,9 @@ en:
registrant:
domains:
index:
+ header: Domains
registrant: Registrant
+ reset_btn: Reset
download_list:
registrant: Registrant
diff --git a/config/locales/registrar/account_activities.en.yml b/config/locales/registrar/account_activities.en.yml
new file mode 100644
index 000000000..27d0150d6
--- /dev/null
+++ b/config/locales/registrar/account_activities.en.yml
@@ -0,0 +1,5 @@
+en:
+ registrar:
+ account_activities:
+ index:
+ reset_btn: Reset
diff --git a/config/locales/registrar/contacts.en.yml b/config/locales/registrar/contacts.en.yml
index 2a3f5ba3e..84afd481d 100644
--- a/config/locales/registrar/contacts.en.yml
+++ b/config/locales/registrar/contacts.en.yml
@@ -1,6 +1,9 @@
en:
registrar:
contacts:
+ index:
+ reset_btn: Reset
+
partials:
domains:
roles: Roles
diff --git a/config/locales/registrar/domain_transfers.en.yml b/config/locales/registrar/domain_transfers.en.yml
new file mode 100644
index 000000000..64663b558
--- /dev/null
+++ b/config/locales/registrar/domain_transfers.en.yml
@@ -0,0 +1,19 @@
+en:
+ registrar:
+ domain_transfers:
+ new:
+ header: Domain transfer
+ single: One by one
+ batch: Batch
+
+ create:
+ header: Domain transfer
+ transferred: Domains have been successfully transferred
+
+ form:
+ single:
+ transfer_btn: Transfer
+
+ batch:
+ batch_file_help: CSV file with domain list provided by another registrar
+ transfer_btn: Transfer batch
diff --git a/config/locales/registrar/domains.en.yml b/config/locales/registrar/domains.en.yml
index 61d5001ad..6ff110694 100644
--- a/config/locales/registrar/domains.en.yml
+++ b/config/locales/registrar/domains.en.yml
@@ -2,14 +2,28 @@ en:
registrar:
domains:
index:
- registrant: Registrant
- download_btn: Download
+ header: Domains
+ new_btn: New domain
+ transfer_btn: Transfer
csv:
domain_name: Domain
+ transfer_code: Transfer code
registrant_name: Registrant name
registrant_code: Registrant code
expire_time: Date of expiry
+ info:
+ transfer_btn: Transfer
+
+ search_form:
+ download_btn: Download as CSV
+ reset_btn: Reset
+
+ domain:
+ edit_btn: Edit
+ renew_btn: Renew
+ delete_btn: Delete
+
form:
save_btn: Save
dnskeys:
diff --git a/config/locales/registrar/invoices.en.yml b/config/locales/registrar/invoices.en.yml
new file mode 100644
index 000000000..1e8ecaafc
--- /dev/null
+++ b/config/locales/registrar/invoices.en.yml
@@ -0,0 +1,5 @@
+en:
+ registrar:
+ invoices:
+ index:
+ reset_btn: Reset
diff --git a/config/routes.rb b/config/routes.rb
index 9a513b434..c49399573 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -54,7 +54,6 @@ Rails.application.routes.draw do
post 'update', as: 'update'
post 'destroy', as: 'destroy'
get 'renew'
- match 'transfer', via: [:post, :get]
get 'edit'
get 'info'
get 'check'
@@ -62,6 +61,7 @@ Rails.application.routes.draw do
get 'search_contacts'
end
end
+ resources :domain_transfers, only: %i[new create]
resources :contacts, constraints: {:id => /[^\/]+(?=#{ ActionController::Renderers::RENDERERS.map{|e| "\\.#{e}\\z"}.join("|") })|[^\/]+/} do
member do
@@ -99,7 +99,7 @@ Rails.application.routes.draw do
namespace :registrant do
root 'domains#index'
- resources :domains do
+ resources :domains, only: %i[index show] do
collection do
get :download_list
end
@@ -107,7 +107,6 @@ Rails.application.routes.draw do
member do
get 'domain_verification_url'
end
-
end
# resources :invoices do
diff --git a/db/migrate/20180112080312_remove_domain_contacts_contact_type.rb b/db/migrate/20180112080312_remove_domain_contacts_contact_type.rb
new file mode 100644
index 000000000..0047c532e
--- /dev/null
+++ b/db/migrate/20180112080312_remove_domain_contacts_contact_type.rb
@@ -0,0 +1,5 @@
+class RemoveDomainContactsContactType < ActiveRecord::Migration
+ def change
+ remove_column :domain_contacts, :contact_type, :string
+ end
+end
diff --git a/db/migrate/20180112084221_add_domain_contacts_contact_id_fk.rb b/db/migrate/20180112084221_add_domain_contacts_contact_id_fk.rb
new file mode 100644
index 000000000..5c6ff341c
--- /dev/null
+++ b/db/migrate/20180112084221_add_domain_contacts_contact_id_fk.rb
@@ -0,0 +1,5 @@
+class AddDomainContactsContactIdFk < ActiveRecord::Migration
+ def change
+ add_foreign_key :domain_contacts, :contacts, name: 'domain_contacts_contact_id_fk'
+ end
+end
diff --git a/db/migrate/20180112084442_add_domain_contacts_domain_id_fk.rb b/db/migrate/20180112084442_add_domain_contacts_domain_id_fk.rb
new file mode 100644
index 000000000..e3a84a688
--- /dev/null
+++ b/db/migrate/20180112084442_add_domain_contacts_domain_id_fk.rb
@@ -0,0 +1,5 @@
+class AddDomainContactsDomainIdFk < ActiveRecord::Migration
+ def change
+ add_foreign_key :domain_contacts, :domains, name: 'domain_contacts_domain_id_fk'
+ end
+end
diff --git a/db/migrate/20180120172042_add_domain_transfers_domain_id_fk.rb b/db/migrate/20180120172042_add_domain_transfers_domain_id_fk.rb
new file mode 100644
index 000000000..3b4a050ca
--- /dev/null
+++ b/db/migrate/20180120172042_add_domain_transfers_domain_id_fk.rb
@@ -0,0 +1,5 @@
+class AddDomainTransfersDomainIdFk < ActiveRecord::Migration
+ def change
+ add_foreign_key :domain_transfers, :domains
+ end
+end
diff --git a/db/migrate/20180120172649_add_domain_transfers_transfer_from_id_fk.rb b/db/migrate/20180120172649_add_domain_transfers_transfer_from_id_fk.rb
new file mode 100644
index 000000000..9e4e6a31f
--- /dev/null
+++ b/db/migrate/20180120172649_add_domain_transfers_transfer_from_id_fk.rb
@@ -0,0 +1,5 @@
+class AddDomainTransfersTransferFromIdFk < ActiveRecord::Migration
+ def change
+ add_foreign_key :domain_transfers, :registrars, column: :transfer_from_id
+ end
+end
diff --git a/db/migrate/20180120172657_add_domain_transfers_transfer_to_id_fk.rb b/db/migrate/20180120172657_add_domain_transfers_transfer_to_id_fk.rb
new file mode 100644
index 000000000..6b0dd0865
--- /dev/null
+++ b/db/migrate/20180120172657_add_domain_transfers_transfer_to_id_fk.rb
@@ -0,0 +1,5 @@
+class AddDomainTransfersTransferToIdFk < ActiveRecord::Migration
+ def change
+ add_foreign_key :domain_transfers, :registrars, column: :transfer_to_id
+ end
+end
diff --git a/db/migrate/20180120182712_drop_log_domain_transfers.rb b/db/migrate/20180120182712_drop_log_domain_transfers.rb
new file mode 100644
index 000000000..1b77aa1bf
--- /dev/null
+++ b/db/migrate/20180120182712_drop_log_domain_transfers.rb
@@ -0,0 +1,5 @@
+class DropLogDomainTransfers < ActiveRecord::Migration
+ def change
+ drop_table :log_domain_transfers
+ end
+end
diff --git a/db/migrate/20180120183441_remove_domain_transfers_paper_trail.rb b/db/migrate/20180120183441_remove_domain_transfers_paper_trail.rb
new file mode 100644
index 000000000..b77b6fffb
--- /dev/null
+++ b/db/migrate/20180120183441_remove_domain_transfers_paper_trail.rb
@@ -0,0 +1,6 @@
+class RemoveDomainTransfersPaperTrail < ActiveRecord::Migration
+ def change
+ remove_column :domain_transfers, :creator_str, :string
+ remove_column :domain_transfers, :updator_str, :string
+ end
+end
diff --git a/db/migrate/20180121165304_rename_domains_auth_info_to_transfer_code.rb b/db/migrate/20180121165304_rename_domains_auth_info_to_transfer_code.rb
new file mode 100644
index 000000000..3f543bb2c
--- /dev/null
+++ b/db/migrate/20180121165304_rename_domains_auth_info_to_transfer_code.rb
@@ -0,0 +1,5 @@
+class RenameDomainsAuthInfoToTransferCode < ActiveRecord::Migration
+ def change
+ rename_column :domains, :auth_info, :transfer_code
+ end
+end
diff --git a/db/migrate/20180122105335_change_domains_transfer_code_to_not_null.rb b/db/migrate/20180122105335_change_domains_transfer_code_to_not_null.rb
new file mode 100644
index 000000000..e4ee8fbc9
--- /dev/null
+++ b/db/migrate/20180122105335_change_domains_transfer_code_to_not_null.rb
@@ -0,0 +1,5 @@
+class ChangeDomainsTransferCodeToNotNull < ActiveRecord::Migration
+ def change
+ change_column_null :domains, :transfer_code, false
+ end
+end
diff --git a/db/migrate/20180123154407_rename_contacts_copy_from_id_to_original_id.rb b/db/migrate/20180123154407_rename_contacts_copy_from_id_to_original_id.rb
new file mode 100644
index 000000000..347137507
--- /dev/null
+++ b/db/migrate/20180123154407_rename_contacts_copy_from_id_to_original_id.rb
@@ -0,0 +1,5 @@
+class RenameContactsCopyFromIdToOriginalId < ActiveRecord::Migration
+ def change
+ rename_column :contacts, :copy_from_id, :original_id
+ end
+end
diff --git a/db/migrate/20180123165604_rename_domain_transfers_transfer_from_id_to_old_registrar_id.rb b/db/migrate/20180123165604_rename_domain_transfers_transfer_from_id_to_old_registrar_id.rb
new file mode 100644
index 000000000..0eae471e4
--- /dev/null
+++ b/db/migrate/20180123165604_rename_domain_transfers_transfer_from_id_to_old_registrar_id.rb
@@ -0,0 +1,5 @@
+class RenameDomainTransfersTransferFromIdToOldRegistrarId < ActiveRecord::Migration
+ def change
+ rename_column :domain_transfers, :transfer_from_id, :old_registrar_id
+ end
+end
diff --git a/db/migrate/20180123170112_rename_domain_transfers_transfer_to_id_to_new_registrar_id.rb b/db/migrate/20180123170112_rename_domain_transfers_transfer_to_id_to_new_registrar_id.rb
new file mode 100644
index 000000000..b00d78c5e
--- /dev/null
+++ b/db/migrate/20180123170112_rename_domain_transfers_transfer_to_id_to_new_registrar_id.rb
@@ -0,0 +1,5 @@
+class RenameDomainTransfersTransferToIdToNewRegistrarId < ActiveRecord::Migration
+ def change
+ rename_column :domain_transfers, :transfer_to_id, :new_registrar_id
+ end
+end
diff --git a/db/migrate/20180125092422_change_contacts_auth_info_to_not_null.rb b/db/migrate/20180125092422_change_contacts_auth_info_to_not_null.rb
new file mode 100644
index 000000000..4b0581a7c
--- /dev/null
+++ b/db/migrate/20180125092422_change_contacts_auth_info_to_not_null.rb
@@ -0,0 +1,5 @@
+class ChangeContactsAuthInfoToNotNull < ActiveRecord::Migration
+ def change
+ change_column_null :contacts, :auth_info, false
+ end
+end
diff --git a/db/migrate/20180126104536_change_contacts_code_to_not_null.rb b/db/migrate/20180126104536_change_contacts_code_to_not_null.rb
new file mode 100644
index 000000000..fc1c653e2
--- /dev/null
+++ b/db/migrate/20180126104536_change_contacts_code_to_not_null.rb
@@ -0,0 +1,5 @@
+class ChangeContactsCodeToNotNull < ActiveRecord::Migration
+ def change
+ change_column_null :contacts, :code, false
+ end
+end
diff --git a/db/migrate/20180126104903_add_unique_constraint_to_contacts_code.rb b/db/migrate/20180126104903_add_unique_constraint_to_contacts_code.rb
new file mode 100644
index 000000000..2e7e7e12b
--- /dev/null
+++ b/db/migrate/20180126104903_add_unique_constraint_to_contacts_code.rb
@@ -0,0 +1,13 @@
+class AddUniqueConstraintToContactsCode < ActiveRecord::Migration
+ def up
+ execute <<-SQL
+ ALTER TABLE contacts ADD CONSTRAINT unique_contact_code UNIQUE (code)
+ SQL
+ end
+
+ def down
+ execute <<-SQL
+ ALTER TABLE contacts DROP CONSTRAINT unique_contact_code
+ SQL
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index d823ae27c..2cad3e06f 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -644,7 +644,7 @@ ALTER SEQUENCE contact_statuses_id_seq OWNED BY contact_statuses.id;
CREATE TABLE contacts (
id integer NOT NULL,
- code character varying,
+ code character varying NOT NULL,
phone character varying,
email character varying,
fax character varying,
@@ -652,7 +652,7 @@ CREATE TABLE contacts (
updated_at timestamp without time zone,
ident character varying,
ident_type character varying,
- auth_info character varying,
+ auth_info character varying NOT NULL,
name character varying,
org_name character varying,
registrar_id integer NOT NULL,
@@ -668,7 +668,7 @@ CREATE TABLE contacts (
statuses character varying[] DEFAULT '{}'::character varying[],
status_notes hstore,
legacy_history_id integer,
- copy_from_id integer,
+ original_id integer,
ident_updated_at timestamp without time zone,
upid integer,
up_date timestamp without time zone
@@ -884,7 +884,6 @@ CREATE TABLE domain_contacts (
id integer NOT NULL,
contact_id integer,
domain_id integer,
- contact_type character varying,
created_at timestamp without time zone,
updated_at timestamp without time zone,
contact_code_cache character varying,
@@ -959,13 +958,11 @@ CREATE TABLE domain_transfers (
status character varying,
transfer_requested_at timestamp without time zone,
transferred_at timestamp without time zone,
- transfer_from_id integer,
- transfer_to_id integer,
+ old_registrar_id integer,
+ new_registrar_id integer,
created_at timestamp without time zone,
updated_at timestamp without time zone,
- wait_until timestamp without time zone,
- creator_str character varying,
- updator_str character varying
+ wait_until timestamp without time zone
);
@@ -1001,7 +998,7 @@ CREATE TABLE domains (
valid_from timestamp without time zone,
valid_to timestamp without time zone,
registrant_id integer NOT NULL,
- auth_info character varying,
+ transfer_code character varying NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
name_dirty character varying,
@@ -1723,44 +1720,6 @@ CREATE SEQUENCE log_domain_statuses_id_seq
ALTER SEQUENCE log_domain_statuses_id_seq OWNED BY log_domain_statuses.id;
---
--- Name: log_domain_transfers; Type: TABLE; Schema: public; Owner: -; Tablespace:
---
-
-CREATE TABLE log_domain_transfers (
- id integer NOT NULL,
- item_type character varying NOT NULL,
- item_id integer NOT NULL,
- event character varying NOT NULL,
- whodunnit character varying,
- object json,
- object_changes json,
- created_at timestamp without time zone,
- session character varying,
- children json,
- uuid character varying
-);
-
-
---
--- Name: log_domain_transfers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE log_domain_transfers_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: log_domain_transfers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE log_domain_transfers_id_seq OWNED BY log_domain_transfers.id;
-
-
--
-- Name: log_domains; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
@@ -3030,13 +2989,6 @@ ALTER TABLE ONLY log_domain_contacts ALTER COLUMN id SET DEFAULT nextval('log_do
ALTER TABLE ONLY log_domain_statuses ALTER COLUMN id SET DEFAULT nextval('log_domain_statuses_id_seq'::regclass);
---
--- Name: id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY log_domain_transfers ALTER COLUMN id SET DEFAULT nextval('log_domain_transfers_id_seq'::regclass);
-
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
@@ -3507,14 +3459,6 @@ ALTER TABLE ONLY log_domain_statuses
ADD CONSTRAINT log_domain_statuses_pkey PRIMARY KEY (id);
---
--- Name: log_domain_transfers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
---
-
-ALTER TABLE ONLY log_domain_transfers
- ADD CONSTRAINT log_domain_transfers_pkey PRIMARY KEY (id);
-
-
--
-- Name: log_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@@ -3683,6 +3627,14 @@ ALTER TABLE ONLY settings
ADD CONSTRAINT settings_pkey PRIMARY KEY (id);
+--
+-- Name: unique_contact_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY contacts
+ ADD CONSTRAINT unique_contact_code UNIQUE (code);
+
+
--
-- Name: unique_zone_origin; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@@ -4172,20 +4124,6 @@ CREATE INDEX index_log_domain_statuses_on_item_type_and_item_id ON log_domain_st
CREATE INDEX index_log_domain_statuses_on_whodunnit ON log_domain_statuses USING btree (whodunnit);
---
--- Name: index_log_domain_transfers_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
---
-
-CREATE INDEX index_log_domain_transfers_on_item_type_and_item_id ON log_domain_transfers USING btree (item_type, item_id);
-
-
---
--- Name: index_log_domain_transfers_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace:
---
-
-CREATE INDEX index_log_domain_transfers_on_whodunnit ON log_domain_transfers USING btree (whodunnit);
-
-
--
-- Name: index_log_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -4474,6 +4412,22 @@ ALTER TABLE ONLY contacts
ADD CONSTRAINT contacts_registrar_id_fk FOREIGN KEY (registrar_id) REFERENCES registrars(id);
+--
+-- Name: domain_contacts_contact_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY domain_contacts
+ ADD CONSTRAINT domain_contacts_contact_id_fk FOREIGN KEY (contact_id) REFERENCES contacts(id);
+
+
+--
+-- Name: domain_contacts_domain_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY domain_contacts
+ ADD CONSTRAINT domain_contacts_domain_id_fk FOREIGN KEY (domain_id) REFERENCES domains(id);
+
+
--
-- Name: domains_registrant_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@@ -4490,6 +4444,14 @@ ALTER TABLE ONLY domains
ADD CONSTRAINT domains_registrar_id_fk FOREIGN KEY (registrar_id) REFERENCES registrars(id);
+--
+-- Name: fk_rails_59c422f73d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY domain_transfers
+ ADD CONSTRAINT fk_rails_59c422f73d FOREIGN KEY (old_registrar_id) REFERENCES registrars(id);
+
+
--
-- Name: fk_rails_78c376257f; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@@ -4498,6 +4460,14 @@ ALTER TABLE ONLY prices
ADD CONSTRAINT fk_rails_78c376257f FOREIGN KEY (zone_id) REFERENCES zones(id);
+--
+-- Name: fk_rails_833ed7f3c0; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY domain_transfers
+ ADD CONSTRAINT fk_rails_833ed7f3c0 FOREIGN KEY (new_registrar_id) REFERENCES registrars(id);
+
+
--
-- Name: fk_rails_86cd2b09f5; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@@ -4506,6 +4476,14 @@ ALTER TABLE ONLY account_activities
ADD CONSTRAINT fk_rails_86cd2b09f5 FOREIGN KEY (account_id) REFERENCES accounts(id);
+--
+-- Name: fk_rails_87b8e40c63; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY domain_transfers
+ ADD CONSTRAINT fk_rails_87b8e40c63 FOREIGN KEY (domain_id) REFERENCES domains(id);
+
+
--
-- Name: fk_rails_b80dbb973d; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@@ -5060,3 +5038,35 @@ INSERT INTO schema_migrations (version) VALUES ('20171121233843');
INSERT INTO schema_migrations (version) VALUES ('20171123035941');
+INSERT INTO schema_migrations (version) VALUES ('20180112080312');
+
+INSERT INTO schema_migrations (version) VALUES ('20180112084221');
+
+INSERT INTO schema_migrations (version) VALUES ('20180112084442');
+
+INSERT INTO schema_migrations (version) VALUES ('20180120172042');
+
+INSERT INTO schema_migrations (version) VALUES ('20180120172649');
+
+INSERT INTO schema_migrations (version) VALUES ('20180120172657');
+
+INSERT INTO schema_migrations (version) VALUES ('20180120182712');
+
+INSERT INTO schema_migrations (version) VALUES ('20180120183441');
+
+INSERT INTO schema_migrations (version) VALUES ('20180121165304');
+
+INSERT INTO schema_migrations (version) VALUES ('20180122105335');
+
+INSERT INTO schema_migrations (version) VALUES ('20180123154407');
+
+INSERT INTO schema_migrations (version) VALUES ('20180123165604');
+
+INSERT INTO schema_migrations (version) VALUES ('20180123170112');
+
+INSERT INTO schema_migrations (version) VALUES ('20180125092422');
+
+INSERT INTO schema_migrations (version) VALUES ('20180126104536');
+
+INSERT INTO schema_migrations (version) VALUES ('20180126104903');
+
diff --git a/doc/controllers_complete.svg b/doc/controllers_complete.svg
index 1c9bc94ec..61ca0ec5f 100644
--- a/doc/controllers_complete.svg
+++ b/doc/controllers_complete.svg
@@ -441,7 +441,6 @@
after_sign_out_path_for
api_user_log_str
current_root_url
-depp_current_user
registrant_request?
registrar_request?
user_for_paper_trail
diff --git a/doc/epp/domain.md b/doc/epp/domain.md
index cd9de65b8..a9c531f7d 100644
--- a/doc/epp/domain.md
+++ b/doc/epp/domain.md
@@ -27,6 +27,9 @@ Domain name mapping protocol short version:
1 Contact reference to the registrant
0-n Contact reference. Admin contact is required if registrant is
a juridical person. Attribute: type="admin / tech"
+ 0-1
+ 1 Transfer code. Attribute: roid="String"
+
1
0-1 Attribute: xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1"
1-n
@@ -72,6 +75,9 @@ Domain name mapping protocol short version:
0-1 Attributes to change
0-1 Contact reference to the registrant
Optional attribute: verified="yes/no"
+ 0-1
+ 1 Transfer code. Attribute: roid="String"
+
0-1 Required if registrant is changing
0-1 Attribute: xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1"
0-1
@@ -115,7 +121,7 @@ Domain name mapping protocol short version:
1 Domain name. Can contain unicode characters.
Attribute: hosts="all / del / sub / none"
0-1 Required if registrar is not the owner of the domain.
- 1 Domain password. Attribute: roid="String"
+ 1 Domain transfer code. Attribute: roid="String"
0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-returns-domain-info)
@@ -148,7 +154,7 @@ Domain name mapping protocol short version:
1 Attribute: xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd"
1 Domain name. Can contain unicode characters.
1
- 1 Domain password. Attribute: roid="String"
+ 1 Domain transfer code. Attribute: roid="String"
0-1
0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
0-1 Base64 encoded document.
diff --git a/doc/epp/keyrelay.md b/doc/epp/keyrelay.md
index 804fed6db..cda7dfa56 100644
--- a/doc/epp/keyrelay.md
+++ b/doc/epp/keyrelay.md
@@ -14,7 +14,7 @@ NB! Keyrelay not implemented.
1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14
1 Public key
1
- 1 Domain password. Attribute: roid="String"
+ 1 Domain transfer code. Attribute: roid="String"
1
0-1 Relative expiry duration (ISO8601).
Required if ext:absolute is not specified
diff --git a/doc/models_brief.svg b/doc/models_brief.svg
index 22d63cfe7..fa3f478c7 100644
--- a/doc/models_brief.svg
+++ b/doc/models_brief.svg
@@ -249,17 +249,6 @@
-
-DomainTransferVersion
-
-DomainTransferVersion
-
-
-DomainTransferVersion->VersionAssociation
-
-
-
-
BankTransactionVersion
@@ -1142,13 +1131,6 @@
versions
-
-DomainTransfer->DomainTransferVersion
-
-
-
-versions
-
ContactStatus->ContactStatusVersion
diff --git a/doc/models_complete.svg b/doc/models_complete.svg
index a4b16517f..148b12942 100644
--- a/doc/models_complete.svg
+++ b/doc/models_complete.svg
@@ -490,28 +490,6 @@
-
-DomainTransferVersion
-
-DomainTransferVersion
-
-id :integer
-item_type :string
-item_id :integer
-event :string
-whodunnit :string
-object :json
-object_changes :json
-created_at :datetime
-session :string
-children :json
-
-
-DomainTransferVersion->VersionAssociation
-
-
-
-
BankTransactionVersion
@@ -812,7 +790,6 @@
id :integer
contact_id :integer
domain_id :integer
-contact_type :string
created_at :datetime
updated_at :datetime
contact_code_cache :string
@@ -944,7 +921,7 @@
valid_from :datetime
valid_to :datetime
registrant_id :integer
-auth_info :string
+transfer_code :string
created_at :datetime
updated_at :datetime
name_dirty :string
@@ -1066,7 +1043,6 @@
id :integer
contact_id :integer
domain_id :integer
-contact_type :string
created_at :datetime
updated_at :datetime
contact_code_cache :string
@@ -1305,8 +1281,8 @@
status :string
transfer_requested_at :datetime
transferred_at :datetime
-transfer_from_id :integer
-transfer_to_id :integer
+old_registrar_id :integer
+new_registrar_id :integer
created_at :datetime
updated_at :datetime
wait_until :datetime
@@ -1345,7 +1321,6 @@
id :integer
contact_id :integer
domain_id :integer
-contact_type :string
created_at :datetime
updated_at :datetime
contact_code_cache :string
@@ -1851,13 +1826,6 @@
versions
-
-DomainTransfer->DomainTransferVersion
-
-
-
-versions
-
ContactStatus->ContactStatusVersion
diff --git a/doc/repp-doc.md b/doc/repp-doc.md
index 8eab257ab..4a79f093f 100644
--- a/doc/repp-doc.md
+++ b/doc/repp-doc.md
@@ -17,4 +17,5 @@ Main communication specification through Restful EPP (REPP):
[Contact related functions](repp/v1/contact.md)
[Domain related functions](repp/v1/domain.md)
+[Domain transfers](repp/v1/domain_transfers.md)
[Account related functions](repp/v1/account.md)
diff --git a/doc/repp/v1/domain.md b/doc/repp/v1/domain.md
index 319713660..adb9c4c8e 100644
--- a/doc/repp/v1/domain.md
+++ b/doc/repp/v1/domain.md
@@ -39,7 +39,7 @@ Content-Type: application/json
"valid_from": "2015-09-09T09:11:14.861Z",
"valid_to": "2016-09-09T09:11:14.861Z",
"registrant_id": 1,
- "auth_info": "98oiewslkfkd",
+ "transfer_code": "98oiewslkfkd",
"created_at": "2015-09-09T09:11:14.861Z",
"updated_at": "2015-09-09T09:11:14.860Z",
"name_dirty": "domain0.ee",
diff --git a/doc/repp/v1/domain_transfers.md b/doc/repp/v1/domain_transfers.md
new file mode 100644
index 000000000..1f821bc6b
--- /dev/null
+++ b/doc/repp/v1/domain_transfers.md
@@ -0,0 +1,48 @@
+# Domain transfers
+
+## POST /repp/v1/domain_transfers
+Transfers domains.
+
+#### Request
+```
+POST /repp/v1/domain_transfers
+Accept: application/json
+Content-Type: application/json
+Authorization: Basic dGVzdDp0ZXN0dGVzdA==
+
+{
+ "data":{
+ "domainTransfers":[
+ {
+ "domainName":"example.com",
+ "transferCode":"63e7"
+ },
+ {
+ "domainName":"example.org",
+ "transferCode":"15f9"
+ }
+ ]
+ }
+}
+```
+
+#### Response on success
+```
+HTTP/1.1 204
+```
+
+#### Response on failure
+```
+HTTP/1.1 400
+Content-Type: application/json
+{
+ "errors":[
+ {
+ "title":"example.com transfer code is wrong"
+ },
+ {
+ "title":"example.org does not exist"
+ }
+ ]
+}
+```
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index 042515f33..c3b67ba88 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -340,7 +340,7 @@ namespace :import do
registered_at
valid_from
valid_to
- auth_info
+ transfer_code
created_at
updated_at
name_dirty
diff --git a/spec/factories/domain_transfer.rb b/spec/factories/domain_transfer.rb
deleted file mode 100644
index 4ecbfd084..000000000
--- a/spec/factories/domain_transfer.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-FactoryBot.define do
- factory :domain_transfer do
- domain
- transfer_from { FactoryBot.create(:registrar) }
- transfer_to { FactoryBot.create(:registrar) }
- end
-end
diff --git a/spec/features/registrar/domains/csv_export_spec.rb b/spec/features/registrar/domains/csv_export_spec.rb
deleted file mode 100644
index 71258db78..000000000
--- a/spec/features/registrar/domains/csv_export_spec.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-require 'rails_helper'
-
-RSpec.feature 'CSV Export' do
- background do
- Setting.api_ip_whitelist_enabled = false
- Setting.registrar_ip_whitelist_enabled = false
- sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance))
- end
-
- scenario 'exports csv' do
- visit registrar_domains_url
- click_link_or_button 'Download'
- end
-end
diff --git a/spec/models/contact_spec.rb b/spec/models/contact_spec.rb
index 80dfb47ad..1703bf90a 100644
--- a/spec/models/contact_spec.rb
+++ b/spec/models/contact_spec.rb
@@ -63,7 +63,7 @@ RSpec.describe Contact do
context 'with valid attributes' do
before :example do
- @contact = create(:contact, auth_info: 'password')
+ @contact = create(:contact)
end
it 'should have one version' do
@@ -87,10 +87,6 @@ RSpec.describe Contact do
@contact.code.should == old_code
end
- it 'should have static password' do
- @contact.auth_info.should == 'password'
- end
-
it 'should have ok status by default' do
@contact.statuses.should == %w(ok)
end
@@ -171,36 +167,22 @@ RSpec.describe Contact do
end
context 'with callbacks' do
- before :example do
- # Ensure callbacks are not taken out from other specs
- Contact.set_callback(:create, :before, :generate_auth_info)
- end
-
context 'after create' do
it 'should not allow to use same code' do
registrar = create(:registrar, code: 'FIXED')
create(:contact,
registrar: registrar,
- code: 'FIXED:new-code',
- auth_info: 'qwe321')
+ code: 'FIXED:new-code')
@contact = build(:contact,
registrar: registrar,
- code: 'FIXED:new-code',
- auth_info: 'qwe321')
+ code: 'FIXED:new-code')
@contact.validate
expect(@contact.errors).to have_key(:code)
end
- it 'should generate a new password' do
- @contact = build(:contact, code: '123asd', auth_info: nil)
- @contact.auth_info.should == nil
- @contact.save.should == true
- @contact.auth_info.should_not be_nil
- end
-
it 'should allow supported code format' do
@contact = build(:contact, code: 'CID:REG1:12345', registrar: create(:registrar, code: 'FIXED'))
@contact.valid?
@@ -227,29 +209,6 @@ RSpec.describe Contact do
@contact.code.should =~ /FIXED:..../
end
end
-
- context 'after update' do
- before :example do
- @contact = build(:contact,
- registrar: create(:registrar, code: 'FIXED'),
- code: '123asd',
- auth_info: 'qwe321')
- @contact.generate_code
- @contact.save
- @contact.code.should == 'FIXED:123ASD'
- @auth_info = @contact.auth_info
- end
-
- it 'should not generate new code' do
- @contact.update_attributes(name: 'qevciherot23')
- @contact.code.should == 'FIXED:123ASD'
- end
-
- it 'should not generate new auth_info' do
- @contact.update_attributes(name: 'fvrsgbqevciherot23')
- @contact.auth_info.should == @auth_info
- end
- end
end
end
end
diff --git a/spec/models/domain_spec.rb b/spec/models/domain_spec.rb
index fe9dae9a6..0ccc9f4fa 100644
--- a/spec/models/domain_spec.rb
+++ b/spec/models/domain_spec.rb
@@ -538,11 +538,6 @@ RSpec.describe Domain do
expect(domain.errors[:base]).to include('Required parameter missing; reserved>pw element required for reserved domains')
end
- it 'generates auth info' do
- d = create(:domain)
- expect(d.auth_info).to_not be_empty
- end
-
it 'manages statuses automatically' do
d = build(:domain)
diff --git a/spec/models/domain_transfer_spec.rb b/spec/models/domain_transfer_spec.rb
deleted file mode 100644
index 5f8bf54a0..000000000
--- a/spec/models/domain_transfer_spec.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-require 'rails_helper'
-
-describe DomainTransfer do
- before :example do
- Setting.ds_algorithm = 2
- Setting.ds_data_allowed = true
- Setting.ds_data_with_key_allowed = true
- Setting.key_data_allowed = true
-
- Setting.dnskeys_min_count = 0
- Setting.dnskeys_max_count = 9
- Setting.ns_min_count = 2
- Setting.ns_max_count = 11
-
- Setting.transfer_wait_time = 0
-
- Setting.admin_contacts_min_count = 1
- Setting.admin_contacts_max_count = 10
- Setting.tech_contacts_min_count = 0
- Setting.tech_contacts_max_count = 10
-
- Setting.client_side_status_editing_enabled = true
-
- create(:zone, origin: 'ee')
- end
-
- context 'with invalid attribute' do
- before :example do
- @domain_transfer = DomainTransfer.new
- end
-
- it 'should not be valid' do
- @domain_transfer.valid?
- @domain_transfer.errors.full_messages.should match_array([
- ])
- end
-
- it 'should not have any versions' do
- @domain_transfer.versions.should == []
- end
- end
-
- context 'with valid attributes' do
- before :example do
- @domain_transfer = create(:domain_transfer)
- end
-
- it 'should be valid' do
- @domain_transfer.valid?
- @domain_transfer.errors.full_messages.should match_array([])
- end
-
- it 'should be valid twice' do
- @domain_transfer = create(:domain_transfer)
- @domain_transfer.valid?
- @domain_transfer.errors.full_messages.should match_array([])
- end
-
- it 'should have one version' do
- with_versioning do
- @domain_transfer.versions.should == []
- @domain_transfer.wait_until = 1.day.since
- @domain_transfer.save
- @domain_transfer.errors.full_messages.should match_array([])
- @domain_transfer.versions.size.should == 1
- end
- end
- end
-end
diff --git a/spec/presenters/domain_presenter_spec.rb b/spec/presenters/domain_presenter_spec.rb
index 717850d17..65f5efc93 100644
--- a/spec/presenters/domain_presenter_spec.rb
+++ b/spec/presenters/domain_presenter_spec.rb
@@ -151,6 +151,7 @@ RSpec.describe DomainPresenter do
domain_delegatable_attributes = %i(
name
+ transfer_code
registrant_name
registrant_id
registrant_code
diff --git a/spec/presenters/registrar/domain_list_csv_presenter_spec.rb b/spec/presenters/registrar/domain_list_csv_presenter_spec.rb
deleted file mode 100644
index df4eec1fe..000000000
--- a/spec/presenters/registrar/domain_list_csv_presenter_spec.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe Registrar::DomainListCSVPresenter do
- let(:domain) { instance_spy(DomainPresenter) }
- let(:csv) { CSV.parse(described_class.new(domains: [domain], view: view).to_s, converters: :all) }
-
- describe 'header' do
- subject(:header) { csv.first }
-
- it 'is present' do
- columns = []
- columns[0] = 'Domain'
- columns[1] = 'Registrant name'
- columns[2] = 'Registrant code'
- columns[3] = 'Date of expiry'
- columns
-
- expect(header).to eq(columns)
- end
- end
-
- describe 'row' do
- subject(:row) { csv.second }
-
- it 'has domain name' do
- expect(domain).to receive(:name).and_return('test name')
- expect(row[0]).to eq('test name')
- end
-
- it 'has registrant name' do
- expect(domain).to receive(:registrant_name).and_return('test registrant name')
- expect(row[1]).to eq('test registrant name')
- end
-
- it 'has registrant code' do
- expect(domain).to receive(:registrant_code).and_return('test registrant code')
- expect(row[2]).to eq('test registrant code')
- end
-
- it 'has expire date' do
- expect(domain).to receive(:expire_date).and_return('expire date')
- expect(row[3]).to eq('expire date')
- end
- end
-end
diff --git a/spec/requests/registrar/domains_controller_spec.rb b/spec/requests/registrar/domains_controller_spec.rb
deleted file mode 100644
index eadb060c0..000000000
--- a/spec/requests/registrar/domains_controller_spec.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe Registrar::DomainsController, db: true do
- describe '#index' do
- before do
- sign_in_to_registrar_area
- end
-
- it 'responds with success' do
- csv_presenter = instance_double(Registrar::DomainListCSVPresenter, to_s: 'csv')
- expect(Registrar::DomainListCSVPresenter).to receive(:new).and_return(csv_presenter)
-
- get registrar_domains_url(format: 'csv')
-
- expect(response.body).to eq('csv')
- end
-
- it 'returns csv' do
- get registrar_domains_url(format: 'csv')
-
- expect(response).to have_http_status(:success)
- end
- end
-end
diff --git a/test/controllers/admin/registrars/update_test.rb b/test/controllers/admin/registrars/update_test.rb
index ae695f3c3..2c996ef44 100644
--- a/test/controllers/admin/registrars/update_test.rb
+++ b/test/controllers/admin/registrars/update_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class RegistrarsControllerTest < ActionDispatch::IntegrationTest
def setup
login_as users(:admin)
- @registrar = registrars(:valid)
+ @registrar = registrars(:bestnames)
end
def test_updates_website
diff --git a/test/fixtures/accounts.yml b/test/fixtures/accounts.yml
new file mode 100644
index 000000000..ea51ff7eb
--- /dev/null
+++ b/test/fixtures/accounts.yml
@@ -0,0 +1,5 @@
+cash:
+ account_type: cash
+ balance: 100
+ currency: EUR
+ registrar: bestnames
diff --git a/test/fixtures/billing/prices.yml b/test/fixtures/billing/prices.yml
new file mode 100644
index 000000000..ef2cd09a7
--- /dev/null
+++ b/test/fixtures/billing/prices.yml
@@ -0,0 +1,7 @@
+cash:
+ duration: 1 year
+ price_cents: 500
+ operation_category: create
+ valid_from: 2010-07-05
+ valid_to: 2010-07-05
+ zone: test
diff --git a/test/fixtures/business_registry_caches.yml b/test/fixtures/business_registry_caches.yml
new file mode 100644
index 000000000..c55c98e0d
--- /dev/null
+++ b/test/fixtures/business_registry_caches.yml
@@ -0,0 +1,8 @@
+first:
+ ident: 1234
+ ident_country_code: US
+ associated_businesses:
+ - 1234
+ retrieved_on: 2010-07-05 10:30
+ created_at: 2010-07-05 10:30
+ updated_at: 2010-07-05 10:30
diff --git a/test/fixtures/contacts.yml b/test/fixtures/contacts.yml
new file mode 100644
index 000000000..b59d9cba3
--- /dev/null
+++ b/test/fixtures/contacts.yml
@@ -0,0 +1,32 @@
+john:
+ name: John
+ email: john@inbox.test
+ phone: '+555.555'
+ ident: 1234
+ ident_type: priv
+ ident_country_code: US
+ registrar: bestnames
+ code: john-001
+ auth_info: cacb5b
+
+jane:
+ name: Jane
+ email: jane@mail.test
+ phone: '+555.555'
+ ident: 1234
+ ident_type: priv
+ ident_country_code: US
+ registrar: bestnames
+ code: jane-001
+ auth_info: 0aa09f
+
+acme_ltd:
+ name: Acme Ltd
+ email: acme@outlook.test
+ phone: '+555.555'
+ ident: 1234
+ ident_type: org
+ registrar: bestnames
+ ident_country_code: US
+ code: acme-ltd-001
+ auth_info: 720b3c
diff --git a/test/fixtures/dns/zones.yml b/test/fixtures/dns/zones.yml
new file mode 100644
index 000000000..40a8a289e
--- /dev/null
+++ b/test/fixtures/dns/zones.yml
@@ -0,0 +1,2 @@
+test:
+ origin: test
diff --git a/test/fixtures/domain_contacts.yml b/test/fixtures/domain_contacts.yml
new file mode 100644
index 000000000..8a429f628
--- /dev/null
+++ b/test/fixtures/domain_contacts.yml
@@ -0,0 +1,14 @@
+shop_jane:
+ domain: shop
+ contact: jane
+ type: AdminDomainContact
+
+airport_john:
+ domain: airport
+ contact: john
+ type: AdminDomainContact
+
+library_john:
+ domain: library
+ contact: john
+ type: AdminDomainContact
diff --git a/test/fixtures/domains.yml b/test/fixtures/domains.yml
new file mode 100644
index 000000000..7c7b429cf
--- /dev/null
+++ b/test/fixtures/domains.yml
@@ -0,0 +1,29 @@
+shop:
+ name: shop.test
+ name_dirty: shop.test
+ registrar: bestnames
+ registrant: john
+ transfer_code: 65078d5
+ valid_to: 2010-07-05
+ period: 1
+ period_unit: m
+
+airport:
+ name: airport.test
+ name_dirty: airport.test
+ registrar: bestnames
+ registrant: john
+ transfer_code: 55438j5
+ valid_to: 2010-07-05
+ period: 1
+ period_unit: m
+
+library:
+ name: library.test
+ name_dirty: library.test
+ registrar: bestnames
+ registrant: acme_ltd
+ transfer_code: 45118f5
+ valid_to: 2010-07-05
+ period: 1
+ period_unit: m
diff --git a/test/fixtures/epp_sessions.yml b/test/fixtures/epp_sessions.yml
new file mode 100644
index 000000000..8cdaedb8c
--- /dev/null
+++ b/test/fixtures/epp_sessions.yml
@@ -0,0 +1,9 @@
+api_bestnames:
+ session_id: 1
+ registrar: bestnames
+ data: <%= Base64.encode64(Marshal.dump({api_user_id: ActiveRecord::Fixtures.identify(:api_bestnames)})) %>
+
+api_goodnames:
+ session_id: 2
+ registrar: goodnames
+ data: <%= Base64.encode64(Marshal.dump({api_user_id: ActiveRecord::Fixtures.identify(:api_goodnames)})) %>
diff --git a/test/fixtures/files/valid_domains_for_transfer.csv b/test/fixtures/files/valid_domains_for_transfer.csv
new file mode 100644
index 000000000..b04d45ba2
--- /dev/null
+++ b/test/fixtures/files/valid_domains_for_transfer.csv
@@ -0,0 +1,2 @@
+Domain,Transfer code,Registrant name,Registrant code,Date of expiry
+shop.test,65078d5,whatever,whatever,2010-07-05
diff --git a/test/fixtures/registrars.yml b/test/fixtures/registrars.yml
index 52b2bbc00..0026f323b 100644
--- a/test/fixtures/registrars.yml
+++ b/test/fixtures/registrars.yml
@@ -1,21 +1,18 @@
-DEFAULTS: &DEFAULTS
- name: Acme Ltd
+bestnames:
+ name: Best Names
reg_no: 1234
+ code: bestnames
+ email: info@bestnames.test
country_code: US
- email: acme@example.com
- code: 1234
- accounting_customer_code: ACCOUNT001
+ accounting_customer_code: bestnames
language: en
-
-valid:
- <<: *DEFAULTS
-
-complete:
- <<: *DEFAULTS
- name: 2
- reg_no: 2
- code: 2
- website: example.com
- email: info@example.com
billing_email: billing@example.com
- vat_no: US12345
+
+goodnames:
+ name: Good Names
+ reg_no: 12345
+ code: goodnames
+ email: info@goodnames.test
+ country_code: US
+ accounting_customer_code: goodnames
+ language: en
diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml
index 860f06c13..b20bd8a83 100644
--- a/test/fixtures/users.yml
+++ b/test/fixtures/users.yml
@@ -1,16 +1,28 @@
-DEFAULTS: &DEFAULTS
- username: test
-
-api:
- <<: *DEFAULTS
+api_bestnames:
+ username: test_bestnames
+ password: testtest
type: ApiUser
- registrar: valid
+ registrar: bestnames
+ active: true
+ roles:
+ - super
+
+api_goodnames:
+ username: test_goodnames
+ password: testtest
+ type: ApiUser
+ registrar: goodnames
+ active: true
roles:
- super
admin:
- <<: *DEFAULTS
+ username: test
type: AdminUser
country_code: US
roles:
- admin
+
+registrant:
+ type: RegistrantUser
+ registrant_ident: US-1234
diff --git a/test/integration/admin/domains_test.rb b/test/integration/admin/domains_test.rb
new file mode 100644
index 000000000..1dfb0dfd1
--- /dev/null
+++ b/test/integration/admin/domains_test.rb
@@ -0,0 +1,13 @@
+require 'test_helper'
+
+class AdminDomainsTestTest < ActionDispatch::IntegrationTest
+ def setup
+ login_as users(:admin)
+ end
+
+ def test_shows_details
+ domain = domains(:shop)
+ visit admin_domain_path(domain)
+ assert_field nil, with: domain.transfer_code
+ end
+end
diff --git a/test/integration/admin/registrars/edit_registrar_test.rb b/test/integration/admin/registrars/edit_registrar_test.rb
index b21488306..ada794032 100644
--- a/test/integration/admin/registrars/edit_registrar_test.rb
+++ b/test/integration/admin/registrars/edit_registrar_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class EditRegistrarTest < ActionDispatch::IntegrationTest
def setup
login_as users(:admin)
- @registrar = registrars(:valid)
+ @registrar = registrars(:bestnames)
end
def test_updates_registrar
diff --git a/test/integration/admin/registrars/show_registrar_test.rb b/test/integration/admin/registrars/show_registrar_test.rb
index b56c3a74f..cb310317c 100644
--- a/test/integration/admin/registrars/show_registrar_test.rb
+++ b/test/integration/admin/registrars/show_registrar_test.rb
@@ -5,12 +5,12 @@ class ShowRegistrarTest < ActionDispatch::IntegrationTest
def setup
login_as users(:admin)
- @registrar = registrars(:complete)
+ @registrar = registrars(:bestnames)
visit admin_registrar_path(@registrar)
end
def test_accounting_customer_code
- assert_text 'ACCOUNT001'
+ assert_text 'bestnames'
end
def test_language
diff --git a/test/integration/api/domain_transfers_test.rb b/test/integration/api/domain_transfers_test.rb
new file mode 100644
index 000000000..0debc37c0
--- /dev/null
+++ b/test/integration/api/domain_transfers_test.rb
@@ -0,0 +1,37 @@
+require 'test_helper'
+
+class APIDomainTransfersTest < ActionDispatch::IntegrationTest
+ def test_transfers_domain
+ request_params = { format: :json,
+ data: { domainTransfers: [{ domainName: 'shop.test', transferCode: '65078d5' }] } }
+ post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
+ assert_response 204
+ assert_equal registrars(:goodnames), domains(:shop).registrar
+ assert_empty response.body
+ end
+
+ def test_fails_if_domain_does_not_exist
+ request_params = { format: :json,
+ data: { domainTransfers: [{ domainName: 'non-existent.test', transferCode: 'any' }] } }
+ post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
+ assert_response 400
+ assert_equal ({ errors: [{ title: 'non-existent.test does not exist' }] }),
+ JSON.parse(response.body, symbolize_names: true)
+ end
+
+ def test_fails_if_transfer_code_is_wrong
+ request_params = { format: :json,
+ data: { domainTransfers: [{ domainName: 'shop.test', transferCode: 'wrong' }] } }
+ post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
+ assert_response 400
+ refute_equal registrars(:goodnames), domains(:shop).registrar
+ assert_equal ({ errors: [{ title: 'shop.test transfer code is wrong' }] }),
+ JSON.parse(response.body, symbolize_names: true)
+ end
+
+ private
+
+ def http_auth_key
+ ActionController::HttpAuthentication::Basic.encode_credentials('test_goodnames', 'testtest')
+ end
+end
diff --git a/test/integration/epp/domain/create/transfer_code_test.rb b/test/integration/epp/domain/create/transfer_code_test.rb
new file mode 100644
index 000000000..f7d70a4ea
--- /dev/null
+++ b/test/integration/epp/domain/create/transfer_code_test.rb
@@ -0,0 +1,63 @@
+require 'test_helper'
+
+class EppDomainCreateTransferCodeTest < ActionDispatch::IntegrationTest
+ def setup
+ travel_to Time.zone.parse('2010-07-05')
+ login_as users(:api_bestnames)
+ end
+
+ def test_generates_default
+ request_xml = <<-XML
+
+
+
+
+
+ brandnew.test
+ 1
+ john-001
+
+
+
+
+ #{'test' * 2000}
+
+
+
+
+ XML
+
+ session_id = epp_sessions(:api_bestnames).session_id
+ post '/epp/command/create', { frame: request_xml }, { 'HTTP_COOKIE' => "session=#{session_id}" }
+ refute_empty Domain.find_by(name: 'brandnew.test').transfer_code
+ end
+
+ def test_honors_custom
+ request_xml = <<-XML
+
+
+
+
+
+ brandnew.test
+ 1
+ john-001
+
+ 1058ad73
+
+
+
+
+
+ #{'test' * 2000}
+
+
+
+
+ XML
+
+ session_id = epp_sessions(:api_bestnames).session_id
+ post '/epp/command/create', { frame: request_xml }, { 'HTTP_COOKIE' => "session=#{session_id}" }
+ assert_equal '1058ad73', Domain.find_by(name: 'brandnew.test').transfer_code
+ end
+end
diff --git a/test/integration/epp/domain/transfer/domain_transfer_test.rb b/test/integration/epp/domain/transfer/domain_transfer_test.rb
new file mode 100644
index 000000000..1b1e604ba
--- /dev/null
+++ b/test/integration/epp/domain/transfer/domain_transfer_test.rb
@@ -0,0 +1,53 @@
+require 'test_helper'
+
+class EppDomainTransferTest < ActionDispatch::IntegrationTest
+ def setup
+ login_as users(:api_goodnames)
+ end
+
+ def test_successfully_transfers_domain
+ request_xml = <<-XML
+
+
+
+
+
+ shop.test
+
+ 65078d5
+
+
+
+
+
+ XML
+
+ session_id = epp_sessions(:api_goodnames).session_id
+ post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => "session=#{session_id}" }
+ assert_equal registrars(:goodnames), domains(:shop).registrar
+ assert Nokogiri::XML(response.body).at_css('result[code="1000"]')
+ assert_equal 1, Nokogiri::XML(response.body).css('result').size
+ end
+
+ def test_non_existent_domain
+ request_xml = <<-XML
+
+
+
+
+
+ non-existent.test
+
+ any
+
+
+
+
+
+ XML
+
+ session_id = epp_sessions(:api_goodnames).session_id
+ post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => "session=#{session_id}" }
+ assert Nokogiri::XML(response.body).at_css('result[code="2303"]')
+ end
+end
diff --git a/test/integration/epp/domain/transfer/transfer_code_test.rb b/test/integration/epp/domain/transfer/transfer_code_test.rb
new file mode 100644
index 000000000..0db6ba0d6
--- /dev/null
+++ b/test/integration/epp/domain/transfer/transfer_code_test.rb
@@ -0,0 +1,30 @@
+require 'test_helper'
+
+class EppDomainTransferTransferCodeTest < ActionDispatch::IntegrationTest
+ def setup
+ login_as users(:api_goodnames)
+ end
+
+ def test_wrong
+ request_xml = <<-XML
+
+
+
+
+
+ shop.test
+
+ wrong
+
+
+
+
+
+ XML
+
+ session_id = epp_sessions(:api_goodnames).session_id
+ post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => "session=#{session_id}" }
+ refute_equal registrars(:goodnames), domains(:shop).registrar
+ assert Nokogiri::XML(response.body).at_css('result[code="2201"]')
+ end
+end
diff --git a/test/integration/epp/domain/update/transfer_code_test.rb b/test/integration/epp/domain/update/transfer_code_test.rb
new file mode 100644
index 000000000..6208c2899
--- /dev/null
+++ b/test/integration/epp/domain/update/transfer_code_test.rb
@@ -0,0 +1,31 @@
+require 'test_helper'
+
+class EppDomainUpdateTest < ActionDispatch::IntegrationTest
+ def setup
+ login_as users(:api_bestnames)
+ end
+
+ def test_overwrites_existing
+ request_xml = <<-XML
+
+
+
+
+
+ shop.test
+
+
+ f0ff7d17b0
+
+
+
+
+
+
+ XML
+
+ session_id = epp_sessions(:api_bestnames).session_id
+ post '/epp/command/update', { frame: request_xml }, { 'HTTP_COOKIE' => "session=#{session_id}" }
+ assert_equal 'f0ff7d17b0', domains(:shop).transfer_code
+ end
+end
diff --git a/test/integration/registrant/domains_test.rb b/test/integration/registrant/domains_test.rb
new file mode 100644
index 000000000..9b1151b84
--- /dev/null
+++ b/test/integration/registrant/domains_test.rb
@@ -0,0 +1,25 @@
+require 'test_helper'
+
+class RegistrantDomainsTest < ActionDispatch::IntegrationTest
+ def setup
+ login_as users(:registrant)
+
+ Setting.days_to_keep_business_registry_cache = 1
+ travel_to Time.zone.parse('2010-07-05')
+ end
+
+ def test_shows_domains_where_current_user_is_registrant
+ visit registrant_domains_url
+ assert_text 'shop.test'
+ end
+
+ def test_shows_domains_where_current_user_is_contact_person
+ visit registrant_domains_url
+ assert_text 'airport.test'
+ end
+
+ def test_shows_domains_where_current_user_has_associated_organizations
+ visit registrant_domains_url
+ assert_text 'library.test'
+ end
+end
diff --git a/test/integration/registrar/domain_transfers_test.rb b/test/integration/registrar/domain_transfers_test.rb
new file mode 100644
index 000000000..46a92859b
--- /dev/null
+++ b/test/integration/registrar/domain_transfers_test.rb
@@ -0,0 +1,43 @@
+require 'test_helper'
+
+class RegistrarDomainTransfersTest < ActionDispatch::IntegrationTest
+ def setup
+ WebMock.reset!
+ login_as users(:api_goodnames)
+ end
+
+ def test_batch_transfer_succeeds
+ body = { data: { domainTransfers: [{ domainName: 'shop.test', transferCode: '65078d5' }] } }
+ headers = { 'Content-type' => 'application/json' }
+ request_stub = stub_request(:post, /domain_transfers/).with(body: body,
+ headers: headers,
+ basic_auth: ['test_goodnames', 'testtest'])
+ .to_return(status: 204)
+
+ visit registrar_domains_url
+ click_link 'Transfer'
+
+ click_on 'Batch'
+ attach_file 'Batch file', Rails.root.join('test', 'fixtures', 'files', 'valid_domains_for_transfer.csv').to_s
+ click_button 'Transfer batch'
+
+ assert_requested request_stub
+ assert_current_path registrar_domains_path
+ assert_text 'Domains have been successfully transferred'
+ end
+
+ def test_batch_transfer_fails_gracefully
+ body = { errors: [{ title: 'epic fail' }] }.to_json
+ headers = { 'Content-type' => 'application/json' }
+ stub_request(:post, /domain_transfers/).to_return(status: 400, body: body, headers: headers)
+
+ visit registrar_domains_url
+ click_link 'Transfer'
+
+ click_on 'Batch'
+ attach_file 'Batch file', Rails.root.join('test', 'fixtures', 'files', 'valid_domains_for_transfer.csv').to_s
+ click_button 'Transfer batch'
+
+ assert_text 'epic fail'
+ end
+end
diff --git a/test/integration/registrar/domains_test.rb b/test/integration/registrar/domains_test.rb
new file mode 100644
index 000000000..51b76fc7c
--- /dev/null
+++ b/test/integration/registrar/domains_test.rb
@@ -0,0 +1,20 @@
+require 'test_helper'
+
+class RegistrarDomainsTest < ActionDispatch::IntegrationTest
+ def test_downloads_domain_list_as_csv
+ login_as users(:api_bestnames)
+ travel_to Time.zone.parse('2010-07-05 10:30')
+
+ expected_csv = <<-CSV.strip_heredoc
+ Domain,Transfer code,Registrant name,Registrant code,Date of expiry
+ library.test,45118f5,Acme Ltd,acme-ltd-001,2010-07-05
+ shop.test,65078d5,John,john-001,2010-07-05
+ airport.test,55438j5,John,john-001,2010-07-05
+ CSV
+
+ visit registrar_domains_url
+ click_button 'Download as CSV'
+ assert_equal 'attachment; filename="Domains_2010-07-05_10.30.csv"', response_headers['Content-Disposition']
+ assert_equal expected_csv, page.body
+ end
+end
diff --git a/test/models/contact/contact_test.rb b/test/models/contact/contact_test.rb
new file mode 100644
index 000000000..aad044592
--- /dev/null
+++ b/test/models/contact/contact_test.rb
@@ -0,0 +1,11 @@
+require 'test_helper'
+
+class ContactTest < ActiveSupport::TestCase
+ def setup
+ @contact = contacts(:john)
+ end
+
+ def test_validates
+ assert @contact.valid?
+ end
+end
diff --git a/test/models/contact/contact_transfer_test.rb b/test/models/contact/contact_transfer_test.rb
new file mode 100644
index 000000000..ae5955230
--- /dev/null
+++ b/test/models/contact/contact_transfer_test.rb
@@ -0,0 +1,70 @@
+require 'test_helper'
+
+class ContactTransferTest < ActiveSupport::TestCase
+ def setup
+ @contact = contacts(:john)
+ @new_registrar = registrars(:goodnames)
+ end
+
+ def test_invalid_without_auth_info
+ @contact.auth_info = nil
+ @contact.validate
+ assert @contact.invalid?
+ end
+
+ def test_default_auth_info
+ contact = Contact.new
+ refute_empty contact.auth_info
+ end
+
+ def test_generated_auth_info_is_random
+ contact = Contact.new
+ another_contact = Contact.new
+ refute_equal contact.auth_info, another_contact.auth_info
+ end
+
+ def test_does_not_regenerate_auth_info_if_contact_is_persisted
+ original_auth_info = @contact.auth_info
+ @contact.save!
+ @contact.reload
+ assert_equal original_auth_info, @contact.auth_info
+ end
+
+ def test_overrides_default_auth_info
+ contact = Contact.new(auth_info: '1bad4f')
+ assert_equal '1bad4f', contact.auth_info
+ end
+
+ def test_keeps_original_contact_untouched
+ original_hash = @contact.to_json
+ @contact.transfer(@new_registrar)
+ @contact.reload
+ assert_equal original_hash, @contact.to_json
+ end
+
+ def test_creates_new_contact
+ assert_difference 'Contact.count' do
+ @contact.transfer(@new_registrar)
+ end
+ end
+
+ def test_changes_registrar
+ new_contact = @contact.transfer(@new_registrar)
+ assert_equal @new_registrar, new_contact.registrar
+ end
+
+ def test_links_to_original
+ new_contact = @contact.transfer(@new_registrar)
+ assert_equal @contact, new_contact.original
+ end
+
+ def test_regenerates_code
+ new_contact = @contact.transfer(@new_registrar)
+ refute_equal @contact.code, new_contact.code
+ end
+
+ def test_regenerates_auth_info
+ new_contact = @contact.transfer(@new_registrar)
+ refute_equal @contact.auth_info, new_contact.auth_info
+ end
+end
diff --git a/test/models/domain/domain_test.rb b/test/models/domain/domain_test.rb
new file mode 100644
index 000000000..a2c3fae55
--- /dev/null
+++ b/test/models/domain/domain_test.rb
@@ -0,0 +1,11 @@
+require 'test_helper'
+
+class DomainTest < ActiveSupport::TestCase
+ def setup
+ @domain = domains(:shop)
+ end
+
+ def test_validates
+ assert @domain.valid?
+ end
+end
diff --git a/test/models/domain/domain_transfer_test.rb b/test/models/domain/domain_transfer_test.rb
new file mode 100644
index 000000000..7b2d2d4c2
--- /dev/null
+++ b/test/models/domain/domain_transfer_test.rb
@@ -0,0 +1,66 @@
+require 'test_helper'
+
+class DomainTransferTest < ActiveSupport::TestCase
+ def setup
+ @domain = domains(:shop)
+ @new_registrar = registrars(:goodnames)
+ end
+
+ def test_invalid_without_transfer_code
+ @domain.transfer_code = nil
+ @domain.validate
+ assert @domain.invalid?
+ end
+
+ def test_default_transfer_code
+ domain = Domain.new
+ refute_empty domain.transfer_code
+ end
+
+ def test_random_transfer_code
+ domain = Domain.new
+ another_domain = Domain.new
+ refute_equal domain.transfer_code, another_domain.transfer_code
+ end
+
+ def test_transfer_code_is_not_regenerated_on_update
+ original_transfer_code = @domain.transfer_code
+ @domain.save!
+ @domain.reload
+ assert_equal original_transfer_code, @domain.transfer_code
+ end
+
+ def test_overrides_default_transfer_code
+ domain = Domain.new(transfer_code: '1bad4f')
+ assert_equal '1bad4f', domain.transfer_code
+ end
+
+ def test_changes_registrar
+ @domain.transfer(@new_registrar)
+ assert_equal @new_registrar, @domain.registrar
+ end
+
+ def test_regenerates_transfer_code
+ old_transfer_code = @domain.transfer_code
+ @domain.transfer(@new_registrar)
+ refute_same old_transfer_code, @domain.transfer_code
+ end
+
+ def test_creates_domain_transfer
+ assert_difference 'DomainTransfer.count' do
+ @domain.transfer(@new_registrar)
+ end
+ end
+
+ def test_creates_message
+ assert_difference 'Message.count' do
+ @domain.transfer(@new_registrar)
+ end
+ end
+
+ def test_copies_contacts
+ assert_difference 'Contact.count', 2 do
+ @domain.transfer(@new_registrar)
+ end
+ end
+end
diff --git a/test/models/registrar_test.rb b/test/models/registrar_test.rb
index 6c92bbff9..58a06b0ae 100644
--- a/test/models/registrar_test.rb
+++ b/test/models/registrar_test.rb
@@ -2,7 +2,7 @@ require 'test_helper'
class RegistrarTest < ActiveSupport::TestCase
def setup
- @registrar = registrars(:valid)
+ @registrar = registrars(:bestnames)
end
def test_valid
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 137bf85d6..7bde0991d 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -10,6 +10,9 @@ require 'rails/test_help'
require 'minitest/mock'
require 'capybara/rails'
require 'capybara/minitest'
+require 'webmock/minitest'
+
+Setting.address_processing = false
class ActiveSupport::TestCase
include FactoryBot::Syntax::Methods
@@ -25,6 +28,7 @@ class ActionDispatch::IntegrationTest
include AbstractController::Translation
def teardown
+ Warden.test_reset!
Capybara.reset_sessions!
Capybara.use_default_driver
end