diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f00bad87..0eb8e8094 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +22.06.2015 +* Update zonefile + 16.06.2015 * Application time_zone should be defined at application.yml, updated application-exaple.yml diff --git a/app/controllers/registrant/sessions_controller.rb b/app/controllers/registrant/sessions_controller.rb index 3d2ab7801..b495a1a6a 100644 --- a/app/controllers/registrant/sessions_controller.rb +++ b/app/controllers/registrant/sessions_controller.rb @@ -56,7 +56,10 @@ class Registrant::SessionsController < Devise::SessionsController session[:user_country] = response.user_country session[:user_id_code] = response.user_id_code session[:mid_session_code] = client.session_code - render json: { message: t(:check_your_phone_for_confirmation_code) }, status: :ok + + render json: { + message: t(:confirmation_sms_was_sent_to_your_phone_verification_code_is, { code: response.challenge_id }) + }, status: :ok else render json: { message: t(:no_such_user) }, status: :unauthorized end diff --git a/app/controllers/registrar/sessions_controller.rb b/app/controllers/registrar/sessions_controller.rb index 1fcd1e914..3fea41f75 100644 --- a/app/controllers/registrar/sessions_controller.rb +++ b/app/controllers/registrar/sessions_controller.rb @@ -111,7 +111,10 @@ class Registrar::SessionsController < Devise::SessionsController if @user.persisted? session[:user_id_code] = response.user_id_code session[:mid_session_code] = client.session_code - render json: { message: t(:check_your_phone_for_confirmation_code) }, status: :ok + + render json: { + message: t(:confirmation_sms_was_sent_to_your_phone_verification_code_is, { code: response.challenge_id }) + }, status: :ok else render json: { message: t(:no_such_user) }, status: :unauthorized end diff --git a/app/models/legacy/zone_ns.rb b/app/models/legacy/zone_ns.rb new file mode 100644 index 000000000..f430e1b11 --- /dev/null +++ b/app/models/legacy/zone_ns.rb @@ -0,0 +1,5 @@ +module Legacy + class ZoneNs < Db + self.table_name = :zone_ns + end +end diff --git a/config/initializers/new_relic_app_name.rb b/config/initializers/new_relic_app_name.rb index a7a08cbb4..662fdf6b1 100644 --- a/config/initializers/new_relic_app_name.rb +++ b/config/initializers/new_relic_app_name.rb @@ -1,3 +1,4 @@ if !Rails.env.test? && ENV['new_relic_app_name'].present? + require 'newrelic' NewRelic::Agent.config[:app_name] = "#{ENV['new_relic_app_name']} - #{Rails.env}" end diff --git a/config/locales/en.yml b/config/locales/en.yml index b95085cc7..2275b13b1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -513,7 +513,7 @@ en: log_in: 'Log in' phone_no: 'Phone number' log_in_with_mid: 'Log in with mobile-id' - check_your_phone_for_confirmation_code: 'Check your phone for confirmation code' + confirmation_sms_was_sent_to_your_phone_verification_code_is: 'Confirmation sms was sent to your phone. Verification code is %{code}.' user_signature_is_invalid: 'User signature is invalid' session_timeout: 'Session timeout' user_cancelled: 'User cancelled' diff --git a/db/data/20150612125720_refactor_domain_statuses.rb b/db/data/20150612125720_refactor_domain_statuses.rb index 679a6642b..00e87b4d0 100644 --- a/db/data/20150612125720_refactor_domain_statuses.rb +++ b/db/data/20150612125720_refactor_domain_statuses.rb @@ -1,11 +1,11 @@ class RefactorDomainStatuses < ActiveRecord::Migration def self.up - Domain.all.each do |x| - x.statuses = [] + Domain.find_each do |x| + statuses = [] x.domain_statuses.each do |ds| - x.statuses << ds.value + statuses << ds.value end - x.save + x.update_column('statuses', statuses) end end diff --git a/db/seeds.rb b/db/seeds.rb index be8f60f2a..16b938cc4 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -122,7 +122,7 @@ ZonefileSetting.where({ Registrar.where( name: 'EIS', reg_no: '90010019', - phone: '+372 727 1000', + phone: '+3727271000', country_code: 'EE', vat_no: 'EE101286464', email: 'info@internet.ee', diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 8436080be..69cdb603f 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -52,6 +52,7 @@ namespace :import do Rake::Task['import:registrars'].invoke Rake::Task['import:contacts'].invoke Rake::Task['import:domains'].invoke + Rake::Task['import:eis_domains'].invoke end desc 'Import registrars' @@ -469,4 +470,245 @@ namespace :import do puts "-----> Imported #{count} new domains in #{(Time.zone.now.to_f - start).round(2)} seconds" end + + desc 'Import EIS domains' + task eis_domains: :environment do + start = Time.zone.now.to_f + puts '-----> Importing EIS domains...' + + eis = Registrar.where( + name: 'EIS', + reg_no: '90010019', + phone: '+3727271000', + country_code: 'EE', + vat_no: 'EE101286464', + email: 'info@internet.ee', + state: 'Harjumaa', + city: 'Tallinn', + street: 'Paldiski mnt 80', + zip: '10617', + url: 'www.internet.ee', + code: 'EIS' + ).first_or_create! + + unless eis.cash_account + eis.accounts.create(account_type: Account::CASH, currency: 'EUR') + eis.save + end + + c = Registrant.where( + name: 'Eesti Interneti Sihtasutus', + phone: '+372.7271000', + email: 'info@internet.ee', + ident: '90010019', + ident_type: 'passport', + city: 'Tallinn', + country_code: 'ee', + street: 'Paldiski mnt 80', + zip: '10617', + registrar: eis + ).first_or_create! + + # ee + ns_list = [] + Legacy::ZoneNs.where(zone: 1).each do |x| + ipv4 = x.addrs.select { |addr| addr.ipv4? }.first + ipv6 = x.addrs.select { |addr| addr.ipv6? }.first + ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6) + end + + Domain.create!( + name: 'ee', + valid_to: Date.new(9999, 1, 1), + period: 1, + period_unit: 'y', + registrant: c, + nameservers: ns_list, + admin_contacts: [c], + tech_contacts: [c], + registrar: eis + ) + + # edu.ee + ns_list = [] + Legacy::ZoneNs.where(zone: 6).each do |x| + ipv4 = x.addrs.select { |addr| addr.ipv4? }.first + ipv6 = x.addrs.select { |addr| addr.ipv6? }.first + ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6) + end + + Domain.create!( + name: 'edu.ee', + valid_to: Date.new(9999, 1, 1), + period: 1, + period_unit: 'y', + registrant: c, + nameservers: ns_list, + admin_contacts: [c], + tech_contacts: [c], + registrar: eis + ) + + # aip.ee + ns_list = [] + Legacy::ZoneNs.where(zone: 9).each do |x| + ipv4 = x.addrs.select { |addr| addr.ipv4? }.first + ipv6 = x.addrs.select { |addr| addr.ipv6? }.first + ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6) + end + + Domain.create!( + name: 'aip.ee', + valid_to: Date.new(9999, 1, 1), + period: 1, + period_unit: 'y', + registrant: c, + nameservers: ns_list, + admin_contacts: [c], + tech_contacts: [c], + registrar: eis + ) + + # org.ee + ns_list = [] + Legacy::ZoneNs.where(zone: 10).each do |x| + ipv4 = x.addrs.select { |addr| addr.ipv4? }.first + ipv6 = x.addrs.select { |addr| addr.ipv6? }.first + ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6) + end + + Domain.create!( + name: 'org.ee', + valid_to: Date.new(9999, 1, 1), + period: 1, + period_unit: 'y', + registrant: c, + nameservers: ns_list, + admin_contacts: [c], + tech_contacts: [c], + registrar: eis + ) + + # pri.ee + ns_list = [] + Legacy::ZoneNs.where(zone: 2).each do |x| + ipv4 = x.addrs.select { |addr| addr.ipv4? }.first + ipv6 = x.addrs.select { |addr| addr.ipv6? }.first + ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6) + end + + Domain.create!( + name: 'pri.ee', + valid_to: Date.new(9999, 1, 1), + period: 1, + period_unit: 'y', + registrant: c, + nameservers: ns_list, + admin_contacts: [c], + tech_contacts: [c], + registrar: eis + ) + + # med.ee + ns_list = [] + Legacy::ZoneNs.where(zone: 3).each do |x| + ipv4 = x.addrs.select { |addr| addr.ipv4? }.first + ipv6 = x.addrs.select { |addr| addr.ipv6? }.first + ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6) + end + + Domain.create!( + name: 'med.ee', + valid_to: Date.new(9999, 1, 1), + period: 1, + period_unit: 'y', + registrant: c, + nameservers: ns_list, + admin_contacts: [c], + tech_contacts: [c], + registrar: eis + ) + + # fie.ee + ns_list = [] + Legacy::ZoneNs.where(zone: 4).each do |x| + ipv4 = x.addrs.select { |addr| addr.ipv4? }.first + ipv6 = x.addrs.select { |addr| addr.ipv6? }.first + ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6) + end + + Domain.create!( + name: 'fie.ee', + valid_to: Date.new(9999, 1, 1), + period: 1, + period_unit: 'y', + registrant: c, + nameservers: ns_list, + admin_contacts: [c], + tech_contacts: [c], + registrar: eis + ) + + # com.ee + ns_list = [] + Legacy::ZoneNs.where(zone: 5).each do |x| + ipv4 = x.addrs.select { |addr| addr.ipv4? }.first + ipv6 = x.addrs.select { |addr| addr.ipv6? }.first + ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6) + end + + Domain.create!( + name: 'com.ee', + valid_to: Date.new(9999, 1, 1), + period: 1, + period_unit: 'y', + registrant: c, + nameservers: ns_list, + admin_contacts: [c], + tech_contacts: [c], + registrar: eis + ) + + # gov.ee + ns_list = [] + Legacy::ZoneNs.where(zone: 7).each do |x| + ipv4 = x.addrs.select { |addr| addr.ipv4? }.first + ipv6 = x.addrs.select { |addr| addr.ipv6? }.first + ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6) + end + + Domain.create!( + name: 'gov.ee', + valid_to: Date.new(9999, 1, 1), + period: 1, + period_unit: 'y', + registrant: c, + nameservers: ns_list, + admin_contacts: [c], + tech_contacts: [c], + registrar: eis + ) + + # riik.ee + ns_list = [] + Legacy::ZoneNs.where(zone: 8).each do |x| + ipv4 = x.addrs.select { |addr| addr.ipv4? }.first + ipv6 = x.addrs.select { |addr| addr.ipv6? }.first + ns_list << Nameserver.new(hostname: x.fqdn, ipv4: ipv4, ipv6: ipv6) + end + + Domain.create!( + name: 'riik.ee', + valid_to: Date.new(9999, 1, 1), + period: 1, + period_unit: 'y', + registrant: c, + nameservers: ns_list, + admin_contacts: [c], + tech_contacts: [c], + registrar: eis + ) + + puts "-----> Imported EIS domains in #{(Time.zone.now.to_f - start).round(2)} seconds" + end end diff --git a/lib/tasks/zonefile.rake b/lib/tasks/zonefile.rake index 3609341cd..4829f5324 100644 --- a/lib/tasks/zonefile.rake +++ b/lib/tasks/zonefile.rake @@ -46,7 +46,7 @@ namespace :zonefile do SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.') FROM domains d JOIN nameservers ns ON ns.domain_id = d.id - WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter + WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter OR d.name = i_origin ORDER BY d.name ), chr(10)