Merge branch 'master' into registry-791

This commit is contained in:
Artur Beljajev 2018-06-15 16:55:58 +03:00
commit 255b0db9cb
190 changed files with 2415 additions and 3682 deletions

View file

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

View file

@ -1,12 +1,12 @@
version: "2"
prepare:
fetch:
- "https://raw.githubusercontent.com/internetee/style-guide/master/ruby/.rubocop.yml"
plugins: plugins:
brakeman: brakeman:
enabled: true enabled: true
bundler-audit: bundler-audit:
enabled: true enabled: true
csslint:
enabled: true
coffeelint:
enabled: true
duplication: duplication:
enabled: true enabled: true
config: config:
@ -17,22 +17,12 @@ plugins:
enabled: true enabled: true
fixme: fixme:
enabled: true enabled: true
config:
strings:
- FIXME
- TODO
- HACK
rubocop: rubocop:
enabled: true enabled: true
channel: rubocop-0-51
reek:
enabled: true
checks:
IrresponsibleModule:
enabled: false
exclude_patterns: exclude_patterns:
- "config/" - "bin/"
- "db/" - "config/"
- "vendor/" - "db/"
- "spec/" - "vendor/"
- "test/" - "test/"
- "spec/"

View file

@ -1,2 +0,0 @@
--exclude-exts=.min.css
--ignore=adjoining-classes,box-model,ids,order-alphabetical,unqualified-attributes

View file

@ -1 +0,0 @@
**/*{.,-}min.js

View file

@ -1,7 +0,0 @@
env:
browser: true
es6: true
jquery: true
extends: google
rules:
require-jsdoc: off

24
.gitignore vendored
View file

@ -1,25 +1,13 @@
*.rbc
capybara-*.html
.rspec
/log /log
/tmp /tmp
/db/*.sqlite3
/public/system /public/system
/public/assets
/coverage/ /coverage/
/spec/tmp
**.orig
config/initializers/secret_token.rb
config/deploy.rb
config/database.yml
config/application.yml
config/environments/development.rb
misc
/export
/import
/ca
/.bundle /.bundle
/vendor/bundle /vendor/bundle
/config/database.yml
/config/application.yml
/config/environments/development.rb
/config/deploy.rb
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: # Do not commit one. Instead, download the latest from https://github.com/internetee/style-guide.
.rvmrc .rubocop.yml

1136
.reek

File diff suppressed because it is too large Load diff

View file

@ -1,4 +0,0 @@
inherit_from: .rubocop_todo.yml
Style/Alias:
EnforcedStyle: prefer_alias_method

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
2.2.7 2.3.7

View file

@ -1,3 +1,31 @@
25.05.2018
* GDPR: updated whois templates with configurable disclaimer [#795](https://github.com/internetee/registry/issues/795)
* GDPR: email forwarding solution to contact private domain registrants without revealing their email addresses [#824](https://github.com/internetee/registry/issues/824)
* EPP: added support for additional digitally signed doc formats like asice, sce, asics, scs, edoc, adoc [#840](https://github.com/internetee/registry/issues/840)
* Registrar: removed handling of newlines from contact form street field [#836](https://github.com/internetee/registry/issues/836)
* Ruby upgrade to version 2.3.7 [#546](https://github.com/internetee/registry/issues/546)
* Devise upgrade to version 4.4.3 [#847](https://github.com/internetee/registry/pull/847)
* Added extra logging to debug Directo integration [#848](https://github.com/internetee/registry/pull/848)
30.04.2018
* Upgrade Ruby on Rails to version 4.2.10 [#826](https://github.com/internetee/registry/issues/826)
* BUG: Admin - fixed internal error in domain_versions and contact_versions views caused by removed db column [#830](https://github.com/internetee/registry/issues/830)
23.04.2018
* WHOIS: domains with deleteCandidate status do not return registration details as domains waiting to be deleted [#789](https://github.com/internetee/registry/issues/789)
* Security: Nokigiri gem update to version 1.8.2 [#823](https://github.com/internetee/registry/pull/823)
* Bug: fixed missing translation error in admin mail templates page [#818](https://github.com/internetee/registry/pull/818)
* Admin: VAT percentage info to registrar profile for setting tax rate for foreign non vat liable registrars [#623](https://github.com/internetee/registry/issues/623)
* Admin: deleteCandidate status is now stressed in domain details view [#792](https://github.com/internetee/registry/issues/792)
* Removed invoice_type from invoice db data as unused [#772](https://github.com/internetee/registry/issues/772)
* Removed valid_from from domain db data as duplicated and unused [#787](https://github.com/internetee/registry/issues/787)
* Set Not null constraint to valid_ti domain db data [#800](https://github.com/internetee/registry/issues/800)
* Removed unused methods [#797](https://github.com/internetee/registry/issues/797)
* Removed unused cron tasks [#782](https://github.com/internetee/registry/issues/782)
* Removed some monkey-patching for flash message logging [#231](https://github.com/internetee/registry/issues/231)
* Added Docker container support for dev and test environments [#821](https://github.com/internetee/registry/issues/821)
* Fix for Travis CI random test failures [#809](https://github.com/internetee/registry/pull/809)
03.04.2018 03.04.2018
* BUG: Fixed bug with sometimes failing bank-link payments [#642](https://github.com/internetee/registry/issues/642) * BUG: Fixed bug with sometimes failing bank-link payments [#642](https://github.com/internetee/registry/issues/642)
* EPP: Domain and associated objects are now validated on domain renew [#678](https://github.com/internetee/registry/issues/678) * EPP: Domain and associated objects are now validated on domain renew [#678](https://github.com/internetee/registry/issues/678)

View file

@ -1,4 +1,4 @@
FROM ruby:2.2 FROM ruby:2.3
MAINTAINER maciej.szlosarczyk@internet.ee MAINTAINER maciej.szlosarczyk@internet.ee
RUN apt-get update > /dev/null && apt-get install -y > /dev/null \ RUN apt-get update > /dev/null && apt-get install -y > /dev/null \

View file

@ -11,8 +11,9 @@ source 'https://rubygems.org'
gem 'SyslogLogger', '2.0', require: 'syslog/logger' gem 'SyslogLogger', '2.0', require: 'syslog/logger'
gem 'iso8601', '0.8.6' # for dates and times gem 'iso8601', '0.8.6' # for dates and times
gem 'rails', '4.2.7.1' # when update, all initializers eis_custom files needs check/update gem 'rails', '4.2.10' # when update, all initializers eis_custom files needs check/update
gem 'rest-client' gem 'rest-client'
gem 'uglifier'
# load env # load env
gem 'figaro', '1.1.1' gem 'figaro', '1.1.1'
@ -52,7 +53,7 @@ gem 'liquid', '3.0.6' # for email templates
# rights # rights
gem 'cancancan', '1.11.0' # autharization gem 'cancancan', '1.11.0' # autharization
gem 'devise', '3.5.4' # authenitcation gem 'devise', '4.4.3' # authenitcation
# rest api # rest api
gem 'grape', '0.12.0' gem 'grape', '0.12.0'
@ -103,7 +104,6 @@ gem 'active_model-errors_details' # Backport from Rails 5, https://github.com/ra
group :development do group :development do
gem 'spring' gem 'spring'
gem 'spring-commands-rspec' gem 'spring-commands-rspec'
gem 'rubocop'
# deploy # deploy
gem 'mina', '0.3.1' # for fast deployment gem 'mina', '0.3.1' # for fast deployment

View file

@ -60,43 +60,42 @@ GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
SyslogLogger (2.0) SyslogLogger (2.0)
actionmailer (4.2.7.1) actionmailer (4.2.10)
actionpack (= 4.2.7.1) actionpack (= 4.2.10)
actionview (= 4.2.7.1) actionview (= 4.2.10)
activejob (= 4.2.7.1) activejob (= 4.2.10)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.7.1) actionpack (4.2.10)
actionview (= 4.2.7.1) actionview (= 4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
rack (~> 1.6) rack (~> 1.6)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.7.1) actionview (4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_model-errors_details (1.3.1) active_model-errors_details (1.3.1)
activemodel (>= 3.2.13, < 5.0.0) activemodel (>= 3.2.13, < 5.0.0)
activesupport activesupport
activejob (4.2.7.1) activejob (4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
globalid (>= 0.3.0) globalid (>= 0.3.0)
activemodel (4.2.7.1) activemodel (4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
builder (~> 3.1) builder (~> 3.1)
activerecord (4.2.7.1) activerecord (4.2.10)
activemodel (= 4.2.7.1) activemodel (= 4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
arel (~> 6.0) arel (~> 6.0)
activerecord-import (0.7.0) activerecord-import (0.7.0)
activerecord (>= 3.0) activerecord (>= 3.0)
activesupport (4.2.7.1) activesupport (4.2.10)
i18n (~> 0.7) i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
@ -109,7 +108,6 @@ GEM
gyoku (>= 0.4.0) gyoku (>= 0.4.0)
nokogiri nokogiri
arel (6.0.4) arel (6.0.4)
ast (2.3.0)
autodoc (0.6.0) autodoc (0.6.0)
actionpack actionpack
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
@ -160,7 +158,7 @@ GEM
unicode_utils (~> 1.4) unicode_utils (~> 1.4)
crack (0.4.3) crack (0.4.3)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
crass (1.0.3) crass (1.0.4)
daemons (1.2.4) daemons (1.2.4)
daemons-rails (1.2.1) daemons-rails (1.2.1)
daemons daemons
@ -168,12 +166,11 @@ GEM
database_cleaner (1.6.1) database_cleaner (1.6.1)
descendants_tracker (0.0.4) descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
devise (3.5.4) devise (4.4.3)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5) railties (>= 4.1.0, < 6.0)
responders responders
thread_safe (~> 0.1)
warden (~> 1.2.3) warden (~> 1.2.3)
diff-lcs (1.3) diff-lcs (1.3)
docile (1.1.5) docile (1.1.5)
@ -189,8 +186,8 @@ GEM
railties (>= 3.0.0) railties (>= 3.0.0)
figaro (1.1.1) figaro (1.1.1)
thor (~> 0.14) thor (~> 0.14)
globalid (0.3.7) globalid (0.4.1)
activesupport (>= 4.1.0) activesupport (>= 4.2.0)
grape (0.12.0) grape (0.12.0)
activesupport activesupport
builder builder
@ -228,7 +225,7 @@ GEM
httpi (2.4.2) httpi (2.4.2)
rack rack
socksify socksify
i18n (0.8.4) i18n (0.8.6)
i18n_data (0.7.0) i18n_data (0.7.0)
ice_nine (0.11.2) ice_nine (0.11.2)
isikukood (0.1.2) isikukood (0.1.2)
@ -251,8 +248,8 @@ GEM
loofah (2.2.2) loofah (2.2.2)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.6.6) mail (2.7.0)
mime-types (>= 1.16, < 4) mini_mime (>= 0.1.1)
method_source (0.8.2) method_source (0.8.2)
mime-types (3.1) mime-types (3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
@ -260,8 +257,9 @@ GEM
mina (0.3.1) mina (0.3.1)
open4 (~> 1.3.4) open4 (~> 1.3.4)
rake rake
mini_mime (1.0.0)
mini_portile2 (2.3.0) mini_portile2 (2.3.0)
minitest (5.10.3) minitest (5.11.3)
monetize (1.6.0) monetize (1.6.0)
money (~> 6.8) money (~> 6.8)
money (6.8.3) money (6.8.3)
@ -280,9 +278,6 @@ GEM
nori (2.6.0) nori (2.6.0)
open4 (1.3.4) open4 (1.3.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
parallel (1.12.0)
parser (2.4.0.0)
ast (~> 2.2)
pdfkit (0.6.2) pdfkit (0.6.2)
pg (0.19.0) pg (0.19.0)
poltergeist (1.14.0) poltergeist (1.14.0)
@ -291,7 +286,6 @@ GEM
websocket-driver (>= 0.2.0) websocket-driver (>= 0.2.0)
polyamorous (1.3.1) polyamorous (1.3.1)
activerecord (>= 3.0) activerecord (>= 3.0)
powerpack (0.1.1)
pry (0.10.1) pry (0.10.1)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.8.1) method_source (~> 0.8.1)
@ -313,35 +307,33 @@ GEM
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
railroady (1.3.0) railroady (1.3.0)
rails (4.2.7.1) rails (4.2.10)
actionmailer (= 4.2.7.1) actionmailer (= 4.2.10)
actionpack (= 4.2.7.1) actionpack (= 4.2.10)
actionview (= 4.2.7.1) actionview (= 4.2.10)
activejob (= 4.2.7.1) activejob (= 4.2.10)
activemodel (= 4.2.7.1) activemodel (= 4.2.10)
activerecord (= 4.2.7.1) activerecord (= 4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.7.1) railties (= 4.2.10)
sprockets-rails sprockets-rails
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.8) rails-dom-testing (1.0.9)
activesupport (>= 4.2.0.beta, < 5.0) activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6) nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1) rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3) rails-html-sanitizer (1.0.4)
loofah (~> 2.0) loofah (~> 2.2, >= 2.2.2)
rails-settings-cached (0.4.1) rails-settings-cached (0.4.1)
rails (>= 4.0.0) rails (>= 4.0.0)
railties (4.2.7.1) railties (4.2.10)
actionpack (= 4.2.7.1) actionpack (= 4.2.10)
activesupport (= 4.2.7.1) activesupport (= 4.2.10)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (2.2.2) rake (12.3.1)
rake
rake (12.0.0)
ransack (1.5.1) ransack (1.5.1)
actionpack (>= 3.0) actionpack (>= 3.0)
activerecord (>= 3.0) activerecord (>= 3.0)
@ -350,8 +342,9 @@ GEM
polyamorous (~> 1.1) polyamorous (~> 1.1)
rdoc (4.3.0) rdoc (4.3.0)
request_store (1.1.0) request_store (1.1.0)
responders (2.3.0) responders (2.4.0)
railties (>= 4.2.0, < 5.1) actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
rest-client (2.0.1) rest-client (2.0.1)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0) mime-types (>= 1.16, < 4.0)
@ -377,14 +370,6 @@ GEM
rspec-mocks (~> 3.6.0) rspec-mocks (~> 3.6.0)
rspec-support (~> 3.6.0) rspec-support (~> 3.6.0)
rspec-support (3.6.0) rspec-support (3.6.0)
rubocop (0.49.1)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
ruby_parser (3.8.4) ruby_parser (3.8.4)
sexp_processor (~> 4.1) sexp_processor (~> 4.1)
safe_yaml (1.0.4) safe_yaml (1.0.4)
@ -430,19 +415,20 @@ GEM
sprockets (3.7.1) sprockets (3.7.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.0) sprockets-rails (3.2.1)
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
thor (0.19.4) thor (0.20.0)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (1.4.1) tilt (1.4.1)
tzinfo (1.2.3) tzinfo (1.2.5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.1.11)
execjs (>= 0.3.0, < 3)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.2) unf_ext (0.0.7.2)
unicode-display_width (1.3.0)
unicode_utils (1.4.0) unicode_utils (1.4.0)
uniform_notifier (1.9.0) uniform_notifier (1.9.0)
uuidtools (2.1.5) uuidtools (2.1.5)
@ -491,7 +477,7 @@ DEPENDENCIES
daemons-rails (= 1.2.1) daemons-rails (= 1.2.1)
data_migrate! data_migrate!
database_cleaner database_cleaner
devise (= 3.5.4) devise (= 4.4.3)
digidoc_client! digidoc_client!
epp (= 1.5.0)! epp (= 1.5.0)!
epp-xml (= 1.1.0)! epp-xml (= 1.1.0)!
@ -522,12 +508,11 @@ DEPENDENCIES
que-web (= 0.4.0) que-web (= 0.4.0)
que_mailer! que_mailer!
railroady (= 1.3.0) railroady (= 1.3.0)
rails (= 4.2.7.1) rails (= 4.2.10)
rails-settings-cached (= 0.4.1) rails-settings-cached (= 0.4.1)
ransack (= 1.5.1) ransack (= 1.5.1)
rest-client rest-client
rspec-rails (~> 3.6) rspec-rails (~> 3.6)
rubocop
sass-rails (= 5.0.6) sass-rails (= 5.0.6)
sdoc (= 0.4.1) sdoc (= 0.4.1)
select2-rails (= 3.5.9.3) select2-rails (= 3.5.9.3)
@ -536,10 +521,11 @@ DEPENDENCIES
simpleidn (= 0.0.7) simpleidn (= 0.0.7)
spring spring
spring-commands-rspec spring-commands-rspec
uglifier
uuidtools (= 2.1.5) uuidtools (= 2.1.5)
validates_email_format_of (= 1.6.3) validates_email_format_of (= 1.6.3)
webmock webmock
whenever (= 0.9.4) whenever (= 0.9.4)
BUNDLED WITH BUNDLED WITH
1.14.6 1.16.1

View file

@ -59,5 +59,6 @@ module Repp
mount Repp::AccountV1 mount Repp::AccountV1
mount Repp::DomainTransfersV1 mount Repp::DomainTransfersV1
mount Repp::NameserversV1 mount Repp::NameserversV1
mount Repp::DomainContactsV1
end end
end end

View file

@ -0,0 +1,47 @@
module Repp
class DomainContactsV1 < Grape::API
version 'v1', using: :path
resource :domains do
resource :contacts do
patch '/' do
current_contact = current_user.registrar.contacts
.find_by(code: params[:current_contact_id])
new_contact = current_user.registrar.contacts.find_by(code: params[:new_contact_id])
unless current_contact
error!({ error: { type: 'invalid_request_error',
param: 'current_contact_id',
message: "No such contact: #{params[:current_contact_id]}"} },
:bad_request)
end
unless new_contact
error!({ error: { type: 'invalid_request_error',
param: 'new_contact_id',
message: "No such contact: #{params[:new_contact_id]}" } },
:bad_request)
end
if new_contact.invalid?
error!({ error: { type: 'invalid_request_error',
param: 'new_contact_id',
message: 'New contact must be valid' } },
:bad_request)
end
if current_contact == new_contact
error!({ error: { type: 'invalid_request_error',
message: 'New contact ID must be different from current' \
' contact ID' } },
:bad_request)
end
affected_domains, skipped_domains = TechDomainContact
.replace(current_contact, new_contact)
@response = { affected_domains: affected_domains, skipped_domains: skipped_domains }
end
end
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View file

@ -0,0 +1,9 @@
(function() {
function initPopover() {
$(function () {
$('[data-toggle="popover"]').popover();
})
}
initPopover();
})();

View file

@ -7,6 +7,8 @@
#= require select2 #= require select2
#= require datepicker #= require datepicker
#= require spell_check #= require spell_check
#= require popover
#= require text_field_trimmer
#= require shared/general #= require shared/general
#= require registrar/autocomplete #= require registrar/autocomplete
#= require registrar/application #= require registrar/application

View file

@ -0,0 +1,15 @@
(function () {
function trimTextFields() {
let selector = 'input[type=text], input[type=search], input[type=email], textarea';
let textFields = document.querySelectorAll(selector);
let listener = function () {
this.value = this.value.trim();
};
for (let field of textFields) {
field.addEventListener('change', listener);
}
}
trimTextFields();
})();

View file

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

View file

@ -3,13 +3,11 @@ module Admin
load_and_authorize_resource load_and_authorize_resource
def index def index
params[:q] ||= {} params[:q] ||= {}
domains = BlockedDomain.all.order(:name) domains = BlockedDomain.all.order(:name)
@q = domains.search(params[:q]) @q = domains.search(params[:q])
@domains = @q.result.page(params[:page]) @domains = @q.result.page(params[:page])
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
def new def new

View file

@ -1,5 +1,7 @@
module Admin module Admin
class ContactVersionsController < BaseController class ContactVersionsController < BaseController
include ObjectVersionsHelper
load_and_authorize_resource load_and_authorize_resource
def index def index
@ -24,7 +26,7 @@ module Admin
versions = ContactVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc) versions = ContactVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
@q = versions.search(params[:q]) @q = versions.search(params[:q])
@versions = @q.result.page(params[:page]) @versions = @q.result.page(params[:page])
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end

View file

@ -22,7 +22,7 @@ module Admin
@contacts = @q.result.uniq.page(params[:page]) @contacts = @q.result.uniq.page(params[:page])
end end
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
def search def search

View file

@ -1,5 +1,7 @@
module Admin module Admin
class DomainVersionsController < BaseController class DomainVersionsController < BaseController
include ObjectVersionsHelper
load_and_authorize_resource load_and_authorize_resource
def index def index
@ -41,7 +43,7 @@ module Admin
versions = DomainVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc) versions = DomainVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
@q = versions.search(params[:q]) @q = versions.search(params[:q])
@versions = @q.result.page(params[:page]) @versions = @q.result.page(params[:page])
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
render "admin/domain_versions/archive" render "admin/domain_versions/archive"
end end

View file

@ -4,9 +4,6 @@ module Admin
before_action :set_domain, only: [:show, :edit, :update, :zonefile] before_action :set_domain, only: [:show, :edit, :update, :zonefile]
helper_method :force_delete_templates helper_method :force_delete_templates
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
def index def index
params[:q] ||= {} params[:q] ||= {}
if params[:statuses_contains] if params[:statuses_contains]
@ -32,13 +29,9 @@ module Admin
end end
end end
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
def show def show
@domain.valid? @domain.valid?
end end

View file

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

View file

@ -4,13 +4,11 @@ module Admin
before_action :set_domain, only: [:edit, :update] before_action :set_domain, only: [:edit, :update]
def index def index
params[:q] ||= {} params[:q] ||= {}
domains = ReservedDomain.all.order(:name) domains = ReservedDomain.all.order(:name)
@q = domains.search(params[:q]) @q = domains.search(params[:q])
@domains = @q.result.page(params[:page]) @domains = @q.result.page(params[:page])
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
def new def new

View file

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

View file

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

View file

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

View file

@ -1,5 +1,4 @@
class EppController < ApplicationController class EppController < ApplicationController
include Iptable
layout false layout false
protect_from_forgery with: :null_session protect_from_forgery with: :null_session
skip_before_action :verify_authenticity_token skip_before_action :verify_authenticity_token
@ -59,11 +58,9 @@ class EppController < ApplicationController
end end
if Rails.env.test? || Rails.env.development? if Rails.env.test? || Rails.env.development?
# rubocop:disable Rails/Output
puts e.backtrace.reverse.join("\n") puts e.backtrace.reverse.join("\n")
puts "\n BACKTRACE REVERSED!\n" puts "\n BACKTRACE REVERSED!\n"
puts "\n FROM-EPP-RESCUE: #{e.message}\n\n\n" puts "\n FROM-EPP-RESCUE: #{e.message}\n\n\n"
# rubocop:enable Rails/Output
else else
logger.error "FROM-EPP-RESCUE: #{e.message}" logger.error "FROM-EPP-RESCUE: #{e.message}"
logger.error e.backtrace.join("\n") logger.error e.backtrace.join("\n")
@ -78,9 +75,7 @@ class EppController < ApplicationController
end end
def generate_svtrid def generate_svtrid
# rubocop: disable Style/VariableName
@svTRID = "ccReg-#{format('%010d', rand(10**10))}" @svTRID = "ccReg-#{format('%010d', rand(10**10))}"
# rubocop: enable Style/VariableName
end end
def params_hash # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE def params_hash # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE
@ -168,7 +163,7 @@ class EppController < ApplicationController
# validate legal document's type here because it may be in most of the requests # validate legal document's type here because it may be in most of the requests
@prefix = nil @prefix = nil
if element_count('extdata > legalDocument') > 0 if element_count('extdata > legalDocument').positive?
requires_attribute('extdata > legalDocument', 'type', values: LegalDocument::TYPES, policy: true) requires_attribute('extdata > legalDocument', 'type', values: LegalDocument::TYPES, policy: true)
end end
@ -279,7 +274,7 @@ class EppController < ApplicationController
def optional(selector, *validations) def optional(selector, *validations)
full_selector = [@prefix, selector].compact.join(' ') full_selector = [@prefix, selector].compact.join(' ')
el = params[:parsed_frame].css(full_selector).first el = params[:parsed_frame].css(full_selector).first
return unless el && el.text.present? return unless el&.text.present?
value = el.text value = el.text
validations.each do |x| validations.each do |x|
@ -324,16 +319,12 @@ class EppController < ApplicationController
epp_errors.empty? epp_errors.empty?
end end
# rubocop: disable Style/PredicateName
def has_attribute(ph, path) # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE def has_attribute(ph, path) # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE
path.reduce(ph) do |location, key| path.reduce(ph) do |location, key|
location.respond_to?(:keys) ? location[key] : nil location.respond_to?(:keys) ? location[key] : nil
end end
end end
# rubocop: enable Style/PredicateName
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
def write_to_epp_log def write_to_epp_log
request_command = params[:command] || params[:action] # error receives :command, other methods receive :action request_command = params[:command] || params[:action] # error receives :command, other methods receive :action
frame = params[:raw_frame] || params[:frame] frame = params[:raw_frame] || params[:frame]
@ -356,14 +347,6 @@ class EppController < ApplicationController
uuid: request.uuid uuid: request.uuid
}) })
end end
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/PerceivedComplexity
def iptables_counter_update
return if ENV['iptables_counter_enabled'].blank? && ENV['iptables_counter_enabled'] != 'true'
return if current_user.blank?
counter_update(current_user.registrar_code, ENV['iptables_server_ip'])
end
def resource def resource
name = self.class.to_s.sub("Epp::","").sub("Controller","").underscore.singularize name = self.class.to_s.sub("Epp::","").sub("Controller","").underscore.singularize
@ -407,4 +390,26 @@ class EppController < ApplicationController
timeout = 5.minutes timeout = 5.minutes
epp_session.updated_at < (Time.zone.now - timeout) epp_session.updated_at < (Time.zone.now - timeout)
end end
def iptables_counter_update
return if ENV['iptables_counter_enabled'].blank? && ENV['iptables_counter_enabled'] != 'true'
return if current_user.blank?
counter_update(current_user.registrar_code, ENV['iptables_server_ip'])
end
def counter_update(registrar_code, ip)
counter_proc = "/proc/net/xt_recent/#{registrar_code}"
begin
File.open(counter_proc, 'a') do |f|
f.puts "+#{ip}"
end
rescue Errno::ENOENT => e
logger.error "IPTABLES COUNTER UPDATE: cannot open #{counter_proc}: #{e}"
rescue Errno::EACCES => e
logger.error "IPTABLES COUNTER UPDATE: no permission #{counter_proc}: #{e}"
rescue IOError => e
logger.error "IPTABLES COUNTER UPDATE: cannot write #{ip} to #{counter_proc}: #{e}"
end
end
end end

View file

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

View file

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

View file

@ -6,7 +6,7 @@ class Registrant::DomainsController < RegistrantController
@q = domains.search(params[:q]) @q = domains.search(params[:q])
@domains = @q.result.page(params[:page]) @domains = @q.result.page(params[:page])
end end
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
def show def show

View file

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

View file

@ -1,3 +1,5 @@
# As non-GDPR compliant, this controller is deprecated. Needs to be replaced with one that relies
# on the REST WHOIS API.
class Registrant::WhoisController < RegistrantController class Registrant::WhoisController < RegistrantController
def index def index
authorize! :view, :registrant_whois authorize! :view, :registrant_whois

View file

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

View file

@ -0,0 +1,20 @@
class Registrar
class BulkChangeController < DeppController
helper_method :available_contacts
def new
authorize! :manage, :repp
render file: 'registrar/bulk_change/new', locals: { active_tab: default_tab }
end
private
def available_contacts
current_user.registrar.contacts.order(:name).pluck(:name, :code)
end
def default_tab
:technical_contact
end
end
end

View file

@ -33,7 +33,7 @@ class Registrar
@contacts = @q.result(distinct: :true).page(params[:page]) @contacts = @q.result(distinct: :true).page(params[:page])
end end
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
def download_list def download_list

View file

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

View file

@ -1,5 +1,5 @@
class Registrar class Registrar
class DomainTransfersController < DeppController class DomainTransfersController < BulkChangeController
before_action do before_action do
authorize! :transfer, Depp::Domain authorize! :transfer, Depp::Domain
end end
@ -58,7 +58,7 @@ class Registrar
redirect_to registrar_domains_url redirect_to registrar_domains_url
else else
@api_errors = parsed_response[:errors] @api_errors = parsed_response[:errors]
render :new render file: 'registrar/bulk_change/new', locals: { active_tab: :bulk_transfer }
end end
else else
params[:request] = true # EPP domain:transfer "op" attribute params[:request] = true # EPP domain:transfer "op" attribute

View file

@ -3,10 +3,6 @@ class Registrar
before_action :init_domain, except: :new before_action :init_domain, except: :new
helper_method :contacts helper_method :contacts
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/MethodLength
def index def index
authorize! :view, Depp::Domain authorize! :view, Depp::Domain
@ -40,7 +36,7 @@ class Registrar
end end
end end
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
respond_to do |format| respond_to do |format|
format.html format.html
@ -58,10 +54,6 @@ class Registrar
end end
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
def info def info
authorize! :info, Depp::Domain authorize! :info, Depp::Domain
@data = @domain.info(params[:domain_name]) if params[:domain_name] @data = @domain.info(params[:domain_name]) if params[:domain_name]

View file

@ -1,9 +1,5 @@
class Registrar class Registrar
class RegistrarNameserversController < DeppController class NameserversController < BulkChangeController
def edit
authorize! :manage, :repp
end
def update def update
authorize! :manage, :repp authorize! :manage, :repp
@ -52,7 +48,7 @@ class Registrar
redirect_to registrar_domains_url redirect_to registrar_domains_url
else else
@api_errors = parsed_response[:errors] @api_errors = parsed_response[:errors]
render :edit render file: 'registrar/bulk_change/new', locals: { active_tab: :nameserver }
end end
end end
end end

View file

@ -1,30 +1,34 @@
class Registrar class Registrar
class PaymentsController < BaseController class PaymentsController < BaseController
protect_from_forgery except: :back protect_from_forgery except: [:back, :callback]
skip_authorization_check # actually anyone can pay, no problems at all skip_authorization_check # actually anyone can pay, no problems at all
skip_before_action :authenticate_user!, :check_ip_restriction, only: [:back] skip_before_action :authenticate_user!, :check_ip_restriction, only: [:back, :callback]
before_action :check_bank before_action :check_supported_payment_method
# to handle existing model we should
# get invoice_id and then get number
# build BankTransaction without connection with right reference number
# do not connect transaction and invoice
def pay def pay
invoice = Invoice.find(params[:invoice_id]) invoice = Invoice.find(params[:invoice_id])
@bank_link = BankLink::Request.new(params[:bank], invoice, self) bank = params[:bank]
@bank_link.make_transaction opts = {
return_url: registrar_return_payment_with_url(
bank, invoice_id: invoice
),
response_url: registrar_response_payment_with_url(
bank, invoice_id: invoice
)
}
@payment = ::PaymentOrders.create_with_type(bank, invoice, opts)
@payment.create_transaction
end end
# connect invoice and transaction
# both back and IPN
def back def back
@bank_link = BankLink::Response.new(params[:bank], params) invoice = Invoice.find(params[:invoice_id])
if @bank_link.valid? && @bank_link.ok? opts = { response: params }
@bank_link.complete_payment @payment = ::PaymentOrders.create_with_type(params[:bank], invoice, opts)
if @payment.valid_response_from_intermediary? && @payment.settled_payment?
@payment.complete_transaction
if @bank_link.invoice.binded? if invoice.binded?
flash[:notice] = t(:pending_applied) flash[:notice] = t(:pending_applied)
else else
flash[:alert] = t(:something_wrong) flash[:alert] = t(:something_wrong)
@ -32,17 +36,31 @@ class Registrar
else else
flash[:alert] = t(:something_wrong) flash[:alert] = t(:something_wrong)
end end
redirect_to registrar_invoice_path(@bank_link.invoice) redirect_to registrar_invoice_path(invoice)
end
def callback
invoice = Invoice.find(params[:invoice_id])
opts = { response: params }
@payment = ::PaymentOrders.create_with_type(params[:bank], invoice, opts)
if @payment.valid_response_from_intermediary? && @payment.settled_payment?
@payment.complete_transaction
end
render status: 200, json: { status: 'ok' }
end end
private private
def banks def check_supported_payment_method
ENV['payments_banks'].split(",").map(&:strip) return if supported_payment_method?
raise StandardError.new("Not supported payment method")
end end
def check_bank
raise StandardError.new("Not Implemented bank") unless banks.include?(params[:bank]) def supported_payment_method?
PaymentOrders::PAYMENT_METHODS.include?(params[:bank])
end end
end end
end end

View file

@ -0,0 +1,59 @@
class Registrar
class TechContactsController < BulkChangeController
def update
authorize! :manage, :repp
uri = URI.parse("#{ENV['repp_url']}domains/contacts")
request = Net::HTTP::Patch.new(uri)
request.set_form_data(current_contact_id: params[:current_contact_id],
new_contact_id: params[:new_contact_id])
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
parsed_response = JSON.parse(response.body, symbolize_names: true)
if response.code == '200'
notices = [t('.replaced')]
notices << "#{t('.affected_domains')}: #{parsed_response[:affected_domains].join(', ')}"
if parsed_response[:skipped_domains]
notices << "#{t('.skipped_domains')}: #{parsed_response[:skipped_domains].join(', ')}"
end
flash[:notice] = notices
redirect_to registrar_domains_url
else
@error = parsed_response[:error]
render file: 'registrar/bulk_change/new', locals: { active_tab: :technical_contact }
end
end
end
end

View file

@ -0,0 +1,15 @@
module ObjectVersionsHelper
def attach_existing_fields(version, new_object)
version.object_changes.to_h.each do |key, value|
method_name = "#{key}=".to_sym
if new_object.respond_to?(method_name)
new_object.public_send(method_name, value.last)
end
end
end
def only_present_fields(version, model)
field_names = model.column_names
version.object.to_h.select { |key, _value| field_names.include?(key) }
end
end

View file

@ -51,4 +51,4 @@ class UpdateWhoisRecordJob < Que::Job
def delete_blocked(name) def delete_blocked(name)
delete_reserved(name) delete_reserved(name)
end end
end end

View file

@ -1,9 +1,5 @@
class Ability class Ability
include CanCan::Ability include CanCan::Ability
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/LineLength
# rubocop: disable Metrics/AbcSize
def initialize(user, ip = nil) def initialize(user, ip = nil)
@ip = ip @ip = ip
alias_action :show, to: :view alias_action :show, to: :view
@ -13,9 +9,9 @@ class Ability
case @user.class.to_s case @user.class.to_s
when 'AdminUser' when 'AdminUser'
@user.roles.each { |role| send(role) } if @user.roles @user.roles&.each { |role| send(role) }
when 'ApiUser' when 'ApiUser'
@user.roles.each { |role| send(role) } if @user.roles @user.roles&.each { |role| send(role) }
when 'RegistrantUser' when 'RegistrantUser'
static_registrant static_registrant
end end
@ -128,8 +124,4 @@ class Ability
def user def user
can :show, :dashboard can :show, :dashboard
end end
# rubocop: enable Metrics/LineLength
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/PerceivedComplexity
end end

View file

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

View file

@ -1,158 +0,0 @@
class BankLink
module Base
def prepend_size(value)
value = (value || "").to_s.strip
string = ""
string << sprintf("%03i", value.size)
string << value
end
end
class Request
include Base
include ActionView::Helpers::NumberHelper
# need controller here in order to handle random ports and domains
# I don't want to do it but has to
attr_accessor :type, :invoice, :controller
def initialize(type, invoice, controller)
@type, @invoice, @controller = type, invoice, controller
end
def url
ENV["payments_#{type}_url"]
end
def fields
@fields ||= (hash = {}
hash["VK_SERVICE"] = "1012"
hash["VK_VERSION"] = "008"
hash["VK_SND_ID"] = ENV["payments_#{type}_seller_account"]
hash["VK_STAMP"] = invoice.number
hash["VK_AMOUNT"] = number_with_precision(invoice.total, :precision => 2, :separator => ".")
hash["VK_CURR"] = invoice.currency
hash["VK_REF"] = ""
hash["VK_MSG"] = invoice.order
hash["VK_RETURN"] = controller.registrar_return_payment_with_url(type)
hash["VK_CANCEL"] = controller.registrar_return_payment_with_url(type)
hash["VK_DATETIME"] = Time.now.strftime("%Y-%m-%dT%H:%M:%S%z")
hash["VK_MAC"] = calc_mac(hash)
hash["VK_ENCODING"] = "UTF-8"
hash["VK_LANG"] = "ENG"
hash)
end
def calc_mac(fields)
pars = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_STAMP VK_AMOUNT VK_CURR VK_REF
VK_MSG VK_RETURN VK_CANCEL VK_DATETIME).freeze
data = pars.map{|e| prepend_size(fields[e]) }.join
sign(data)
end
def make_transaction
transaction = BankTransaction.where(description: fields["VK_MSG"]).first_or_initialize(
reference_no: invoice.reference_no,
currency: invoice.currency,
iban: invoice.seller_iban
)
transaction.save!
end
private
def sign(data)
private_key = OpenSSL::PKey::RSA.new(File.read(ENV["payments_#{type}_seller_private"]))
signed_data = private_key.sign(OpenSSL::Digest::SHA1.new, data)
signed_data = Base64.encode64(signed_data).gsub(/\n|\r/, '')
signed_data
end
end
class Response
include Base
include ActionView::Helpers::NumberHelper
attr_accessor :type, :params, :invoice
def initialize(type, params)
@type, @params = type, params
@invoice = Invoice.find_by(number: params["VK_STAMP"]) if params["VK_STAMP"].present?
end
def valid?
!!validate
end
def ok?
params["VK_SERVICE"] == "1111"
end
def complete_payment
if valid?
transaction = BankTransaction.find_by(description: params["VK_MSG"])
transaction.sum = BigDecimal.new(params["VK_AMOUNT"].to_s)
transaction.bank_reference = params['VK_T_NO']
transaction.buyer_bank_code = params["VK_SND_ID"]
transaction.buyer_iban = params["VK_SND_ACC"]
transaction.buyer_name = params["VK_SND_NAME"]
transaction.paid_at = Time.parse(params["VK_T_DATETIME"])
transaction.save!
transaction.autobind_invoice
end
end
def validate
case params["VK_SERVICE"]
when "1111"
validate_success && validate_amount && validate_currency
when "1911"
validate_cancel
else
false
end
end
def validate_success
pars = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP VK_T_NO VK_AMOUNT VK_CURR
VK_REC_ACC VK_REC_NAME VK_SND_ACC VK_SND_NAME VK_REF VK_MSG VK_T_DATETIME).freeze
@validate_success ||= (
data = pars.map{|e| prepend_size(params[e]) }.join
verify_mac(data, params["VK_MAC"])
)
end
def validate_cancel
pars = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP VK_REF VK_MSG).freeze
@validate_cancel ||= (
data = pars.map{|e| prepend_size(params[e]) }.join
verify_mac(data, params["VK_MAC"])
)
end
def validate_amount
source = number_with_precision(BigDecimal.new(params["VK_AMOUNT"].to_s), precision: 2, separator: ".")
target = number_with_precision(invoice.total, precision: 2, separator: ".")
source == target
end
def validate_currency
invoice.currency == params["VK_CURR"]
end
def verify_mac(data, mac)
bank_public_key = OpenSSL::X509::Certificate.new(File.read(ENV["payments_#{type}_bank_certificate"])).public_key
bank_public_key.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(mac), data)
end
end
end

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -167,8 +167,6 @@ module Depp
ret.with_indifferent_access ret.with_indifferent_access
end end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def construct_params_from_server_data(data) def construct_params_from_server_data(data)
ret = default_params ret = default_params
ret[:name] = data.css('name').text ret[:name] = data.css('name').text
@ -209,8 +207,6 @@ module Depp
ret ret
end end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
def construct_custom_params_hash(domain_params) def construct_custom_params_hash(domain_params)
custom_params = { _anonymus: [] } custom_params = { _anonymus: [] }
@ -228,8 +224,6 @@ module Depp
custom_params custom_params
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def construct_edit_hash(domain_params, old_domain_params) def construct_edit_hash(domain_params, old_domain_params)
contacts = array_difference(create_contacts_hash(domain_params), create_contacts_hash(old_domain_params)) contacts = array_difference(create_contacts_hash(domain_params), create_contacts_hash(old_domain_params))
add_anon = contacts add_anon = contacts
@ -262,8 +256,6 @@ module Depp
chg: chg chg: chg
} }
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def construct_ext_edit_hash(domain_params, old_domain_params) def construct_ext_edit_hash(domain_params, old_domain_params)
rem_keys = create_dnskeys_hash(old_domain_params) - create_dnskeys_hash(domain_params) rem_keys = create_dnskeys_hash(old_domain_params) - create_dnskeys_hash(domain_params)

View file

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

View file

@ -29,14 +29,12 @@ class Directo < ActiveRecord::Base
"InvoiceDate" => invoice.created_at.strftime("%Y-%m-%dT%H:%M:%S"), "InvoiceDate" => invoice.created_at.strftime("%Y-%m-%dT%H:%M:%S"),
"PaymentTerm" => Setting.directo_receipt_payment_term, "PaymentTerm" => Setting.directo_receipt_payment_term,
"Currency" => invoice.currency, "Currency" => invoice.currency,
"CustomerCode"=> invoice.buyer.accounting_customer_code, "CustomerCode"=> invoice.buyer.accounting_customer_code
'TotalVAT' => ActionController::Base.helpers.number_with_precision(invoice.vat_amount, precision: 2, separator: '.')
){ ){
xml.line( xml.line(
"ProductID" => Setting.directo_receipt_product_name, "ProductID" => Setting.directo_receipt_product_name,
"Quantity" => 1, "Quantity" => 1,
"UnitPriceWoVAT" => ActionController::Base.helpers.number_with_precision(invoice.subtotal, precision: 2, separator: '.'), "UnitPriceWoVAT" => ActionController::Base.helpers.number_with_precision(invoice.subtotal, precision: 2, separator: "."),
'VATCode' => invoice.buyer_vat_no,
"ProductName" => invoice.order "ProductName" => invoice.order
) )
} }
@ -45,8 +43,10 @@ class Directo < ActiveRecord::Base
end end
data = builder.to_xml.gsub("\n",'') data = builder.to_xml.gsub("\n",'')
response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false).to_s Rails.logger.info("[Directo] XML request: #{data}")
dump_result_to_db(mappers, response) response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false)
Rails.logger.info("[Directo] Directo responded with code: #{response.code}, body: #{response.body}")
dump_result_to_db(mappers, response.to_s)
end end
STDOUT << "#{Time.zone.now.utc} - Directo receipts sending finished. #{counter} of #{total} are sent\n" STDOUT << "#{Time.zone.now.utc} - Directo receipts sending finished. #{counter} of #{total} are sent\n"
@ -165,11 +165,15 @@ class Directo < ActiveRecord::Base
end end
data = builder.to_xml.gsub("\n",'') data = builder.to_xml.gsub("\n",'')
Rails.logger.info("[Directo] XML request: #{data}")
if debug if debug
STDOUT << "#{Time.zone.now.utc} - Directo xml had to be sent #{data}\n" STDOUT << "#{Time.zone.now.utc} - Directo xml had to be sent #{data}\n"
else else
response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false).to_s response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false)
Rails.logger.info("[Directo] Directo responded with code: #{response.code}, body: #{response.body}")
response = response.to_s
Setting.directo_monthly_number_last = directo_next Setting.directo_monthly_number_last = directo_next
Nokogiri::XML(response).css("Result").each do |res| Nokogiri::XML(response).css("Result").each do |res|
Directo.create!(request: data, response: res.as_json.to_h, invoice_number: directo_next) Directo.create!(request: data, response: res.as_json.to_h, invoice_number: directo_next)
@ -190,4 +194,3 @@ class Directo < ActiveRecord::Base
@pricelists[account_activity.price_id] = account_activity.price @pricelists[account_activity.price_id] = account_activity.price
end end
end end

View file

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

View file

@ -92,7 +92,7 @@ class DomainCron
if domain.save(validate: false) if domain.save(validate: false)
::PaperTrail.whodunnit = "cron - #{__method__}" ::PaperTrail.whodunnit = "cron - #{__method__}"
DomainDeleteJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) DomainDeleteJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now)
STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: job added by deleteCandidate status ##{domain.id} (#{domain.name})\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by deleteCandidate status ##{domain.id} (#{domain.name})\n" unless Rails.env.test?
c += 1 c += 1
end end
end end

View file

@ -19,9 +19,6 @@ class Epp::Contact < Contact
find_by(code: code) find_by(code: code)
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
def attrs_from(frame, new_record: false) def attrs_from(frame, new_record: false)
f = frame f = frame
at = {}.with_indifferent_access at = {}.with_indifferent_access
@ -45,9 +42,6 @@ class Epp::Contact < Contact
at.merge!(ident_attrs(f.css('ident').first)) if new_record at.merge!(ident_attrs(f.css('ident').first)) if new_record
at at
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
def new(frame, registrar) def new(frame, registrar)
return super if frame.blank? return super if frame.blank?
@ -147,7 +141,7 @@ class Epp::Contact < Contact
end end
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? frame.css("legalDocument").first.content = doc.path if doc&.persisted?
self.legal_document_id = doc.id self.legal_document_id = doc.id
end end
@ -238,7 +232,7 @@ class Epp::Contact < Contact
) )
self.legal_documents = [doc] self.legal_documents = [doc]
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? frame.css("legalDocument").first.content = doc.path if doc&.persisted?
self.legal_document_id = doc.id self.legal_document_id = doc.id
end end

View file

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

View file

@ -6,7 +6,8 @@ class LegalDocument < ActiveRecord::Base
if ENV['legal_document_types'].present? if ENV['legal_document_types'].present?
TYPES = ENV['legal_document_types'].split(',').map(&:strip) TYPES = ENV['legal_document_types'].split(',').map(&:strip)
else else
TYPES = %w(pdf bdoc ddoc zip rar gz tar 7z odt doc docx).freeze TYPES = %w(pdf asice asics sce scs adoc edoc bdoc ddoc zip rar gz tar 7z odt
doc docx).freeze
end end
attr_accessor :body attr_accessor :body

View file

@ -0,0 +1,15 @@
module PaymentOrders
PAYMENT_INTERMEDIARIES = ENV['payments_intermediaries'].to_s.strip.split(', ').freeze
PAYMENT_BANKLINK_BANKS = ENV['payments_banks'].to_s.strip.split(', ').freeze
PAYMENT_METHODS = [PAYMENT_INTERMEDIARIES, PAYMENT_BANKLINK_BANKS].flatten.freeze
def self.create_with_type(type, invoice, opts = {})
raise ArgumentError unless PAYMENT_METHODS.include?(type)
if PAYMENT_BANKLINK_BANKS.include?(type)
BankLink.new(type, invoice, opts)
elsif type == 'every_pay'
EveryPay.new(type, invoice, opts)
end
end
end

View file

@ -0,0 +1,146 @@
module PaymentOrders
class BankLink < Base
BANK_LINK_VERSION = '008'
NEW_TRANSACTION_SERVICE_NUMBER = '1012'
SUCCESSFUL_PAYMENT_SERVICE_NUMBER = '1111'
CANCELLED_PAYMENT_SERVICE_NUMBER = '1911'
NEW_MESSAGE_KEYS = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_STAMP VK_AMOUNT
VK_CURR VK_REF VK_MSG VK_RETURN VK_CANCEL
VK_DATETIME).freeze
SUCCESS_MESSAGE_KEYS = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP
VK_T_NO VK_AMOUNT VK_CURR VK_REC_ACC VK_REC_NAME
VK_SND_ACC VK_SND_NAME VK_REF VK_MSG
VK_T_DATETIME).freeze
CANCEL_MESSAGE_KEYS = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP
VK_REF VK_MSG).freeze
def form_fields
hash = {}
hash["VK_SERVICE"] = NEW_TRANSACTION_SERVICE_NUMBER
hash["VK_VERSION"] = BANK_LINK_VERSION
hash["VK_SND_ID"] = seller_account
hash["VK_STAMP"] = invoice.number
hash["VK_AMOUNT"] = number_with_precision(invoice.total, precision: 2, separator: ".")
hash["VK_CURR"] = invoice.currency
hash["VK_REF"] = ""
hash["VK_MSG"] = invoice.order
hash["VK_RETURN"] = return_url
hash["VK_CANCEL"] = return_url
hash["VK_DATETIME"] = Time.zone.now.strftime("%Y-%m-%dT%H:%M:%S%z")
hash["VK_MAC"] = calc_mac(hash)
hash["VK_ENCODING"] = "UTF-8"
hash["VK_LANG"] = "ENG"
hash
end
def valid_response_from_intermediary?
return false unless response
case response["VK_SERVICE"]
when SUCCESSFUL_PAYMENT_SERVICE_NUMBER
valid_successful_transaction?
when CANCELLED_PAYMENT_SERVICE_NUMBER
valid_cancel_notice?
else
false
end
end
def complete_transaction
return unless valid_successful_transaction?
transaction = BankTransaction.find_by(
description: invoice.order,
currency: invoice.currency,
iban: invoice.seller_iban
)
transaction.sum = response['VK_AMOUNT']
transaction.bank_reference = response['VK_T_NO']
transaction.buyer_bank_code = response["VK_SND_ID"]
transaction.buyer_iban = response["VK_SND_ACC"]
transaction.buyer_name = response["VK_SND_NAME"]
transaction.paid_at = Time.parse(response["VK_T_DATETIME"])
transaction.save!
transaction.autobind_invoice
end
def settled_payment?
response["VK_SERVICE"] == SUCCESSFUL_PAYMENT_SERVICE_NUMBER
end
private
def valid_successful_transaction?
valid_success_notice? && valid_amount? && valid_currency?
end
def valid_cancel_notice?
valid_mac?(response, CANCEL_MESSAGE_KEYS)
end
def valid_success_notice?
valid_mac?(response, SUCCESS_MESSAGE_KEYS)
end
def valid_amount?
source = number_with_precision(
BigDecimal.new(response["VK_AMOUNT"]), precision: 2, separator: "."
)
target = number_with_precision(
invoice.total, precision: 2, separator: "."
)
source == target
end
def valid_currency?
invoice.currency == response["VK_CURR"]
end
def sign(data)
private_key = OpenSSL::PKey::RSA.new(File.read(seller_certificate))
signed_data = private_key.sign(OpenSSL::Digest::SHA1.new, data)
signed_data = Base64.encode64(signed_data).gsub(/\n|\r/, '')
signed_data
end
def calc_mac(fields)
pars = NEW_MESSAGE_KEYS
data = pars.map { |element| prepend_size(fields[element]) }.join
sign(data)
end
def valid_mac?(hash, keys)
data = keys.map { |element| prepend_size(hash[element]) }.join
verify_mac(data, hash["VK_MAC"])
end
def verify_mac(data, mac)
bank_public_key = OpenSSL::X509::Certificate.new(File.read(bank_certificate)).public_key
bank_public_key.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(mac), data)
end
def prepend_size(value)
value = (value || "").to_s.strip
string = ""
string << format("%03i", value.size)
string << value
end
def seller_account
ENV["payments_#{type}_seller_account"]
end
def seller_certificate
ENV["payments_#{type}_seller_private"]
end
def bank_certificate
ENV["payments_#{type}_bank_certificate"]
end
end
end

View file

@ -0,0 +1,33 @@
module PaymentOrders
class Base
include ActionView::Helpers::NumberHelper
attr_reader :type,
:invoice,
:return_url,
:response_url,
:response
def initialize(type, invoice, opts = {})
@type = type
@invoice = invoice
@return_url = opts[:return_url]
@response_url = opts[:response_url]
@response = opts[:response]
end
def create_transaction
transaction = BankTransaction.where(description: invoice.order).first_or_initialize(
reference_no: invoice.reference_no,
currency: invoice.currency,
iban: invoice.seller_iban
)
transaction.save!
end
def form_url
ENV["payments_#{type}_url"]
end
end
end

View file

@ -0,0 +1,84 @@
module PaymentOrders
class EveryPay < Base
USER = ENV['payments_every_pay_api_user'].freeze
KEY = ENV['payments_every_pay_api_key'].freeze
ACCOUNT_ID = ENV['payments_every_pay_seller_account'].freeze
SUCCESSFUL_PAYMENT = %w(settled authorized).freeze
def form_fields
base_json = base_params
base_json[:nonce] = SecureRandom.hex(15)
hmac_fields = (base_json.keys + ['hmac_fields']).sort.uniq!
base_json[:hmac_fields] = hmac_fields.join(',')
hmac_string = hmac_fields.map { |key, _v| "#{key}=#{base_json[key]}" }.join('&')
hmac = OpenSSL::HMAC.hexdigest('sha1', KEY, hmac_string)
base_json[:hmac] = hmac
base_json
end
def valid_response_from_intermediary?
return false unless response
valid_hmac? && valid_amount? && valid_account?
end
def settled_payment?
SUCCESSFUL_PAYMENT.include?(response[:payment_state])
end
def complete_transaction
return unless valid_response_from_intermediary? && settled_payment?
transaction = BankTransaction.find_by(
description: invoice.order,
currency: invoice.currency,
iban: invoice.seller_iban
)
transaction.sum = response[:amount]
transaction.paid_at = Date.strptime(response[:timestamp], '%s')
transaction.buyer_name = response[:cc_holder_name]
transaction.save!
transaction.autobind_invoice
end
private
def base_params
{
api_username: USER,
account_id: ACCOUNT_ID,
timestamp: Time.now.to_i.to_s,
callback_url: response_url,
customer_url: return_url,
amount: number_with_precision(invoice.total, precision: 2),
order_reference: SecureRandom.hex(15),
transaction_type: 'charge',
hmac_fields: ''
}.with_indifferent_access
end
def valid_hmac?
hmac_fields = response[:hmac_fields].split(',')
hmac_hash = {}
hmac_fields.map do |field|
symbol = field.to_sym
hmac_hash[symbol] = response[symbol]
end
hmac_string = hmac_hash.map { |key, _v| "#{key}=#{hmac_hash[key]}" }.join('&')
expected_hmac = OpenSSL::HMAC.hexdigest('sha1', KEY, hmac_string)
expected_hmac == response[:hmac]
end
def valid_amount?
invoice.total == BigDecimal.new(response[:amount])
end
def valid_account?
response[:account_id] == ACCOUNT_ID
end
end
end

View file

@ -54,8 +54,6 @@ class Registrar < ActiveRecord::Base
end end
end end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def issue_prepayment_invoice(amount, description = nil) def issue_prepayment_invoice(amount, description = nil)
invoices.create( invoices.create(
due_date: (Time.zone.now.to_date + Setting.days_to_keep_invoices_active.days).end_of_day, due_date: (Time.zone.now.to_date + Setting.days_to_keep_invoices_active.days).end_of_day,
@ -99,8 +97,6 @@ class Registrar < ActiveRecord::Base
] ]
) )
end end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
def cash_account def cash_account
accounts.find_by(account_type: Account::CASH) accounts.find_by(account_type: Account::CASH)

View file

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

View file

@ -1,2 +1,23 @@
class TechDomainContact < DomainContact class TechDomainContact < DomainContact
# Audit log is needed, therefore no raw SQL
def self.replace(current_contact, new_contact)
affected_domains = []
skipped_domains = []
tech_contacts = where(contact: current_contact)
transaction do
tech_contacts.each do |tech_contact|
if tech_contact.domain.discarded?
skipped_domains << tech_contact.domain.name
next
end
tech_contact.contact = new_contact
tech_contact.save!
affected_domains << tech_contact.domain.name
end
end
return affected_domains.sort, skipped_domains.sort
end
end end

View file

@ -17,8 +17,6 @@ class WhoisRecord < ActiveRecord::Base
@generated_json ||= generate_json @generated_json ||= generate_json
end end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def generate_json def generate_json
h = HashWithIndifferentAccess.new h = HashWithIndifferentAccess.new
return h if domain.blank? return h if domain.blank?
@ -36,6 +34,7 @@ class WhoisRecord < ActiveRecord::Base
registrant = domain.registrant registrant = domain.registrant
@disclosed = [] @disclosed = []
h[:disclaimer] = disclaimer_text if disclaimer_text.present?
h[:name] = domain.name h[:name] = domain.name
h[:status] = domain.statuses.map { |x| status_map[x] || x } h[:status] = domain.statuses.map { |x| status_map[x] || x }
h[:registered] = domain.registered_at.try(:to_s, :iso8601) h[:registered] = domain.registered_at.try(:to_s, :iso8601)
@ -98,9 +97,6 @@ class WhoisRecord < ActiveRecord::Base
template = Rails.root.join("app/views/for_models/#{template_name}".freeze) template = Rails.root.join("app/views/for_models/#{template_name}".freeze)
ERB.new(template.read, nil, "-").result(binding) ERB.new(template.read, nil, "-").result(binding)
end end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
def populate def populate
return if domain_id.blank? return if domain_id.blank?
@ -120,4 +116,10 @@ class WhoisRecord < ActiveRecord::Base
def destroy_whois_record def destroy_whois_record
Whois::Record.where(name: name).delete_all Whois::Record.where(name: name).delete_all
end end
private
def disclaimer_text
Setting.registry_whois_disclaimer
end
end end

View file

@ -26,18 +26,14 @@ class DomainNameValidator < ActiveModel::EachValidator
value = SimpleIDN.to_unicode(value).mb_chars.downcase.strip value = SimpleIDN.to_unicode(value).mb_chars.downcase.strip
end end
# rubocop: disable Metrics/LineLength
unicode_chars = /\u00E4\u00F5\u00F6\u00FC\u0161\u017E/ # äõöüšž unicode_chars = /\u00E4\u00F5\u00F6\u00FC\u0161\u017E/ # äõöüšž
regexp = /\A[a-zA-Z0-9#{unicode_chars.source}][a-zA-Z0-9#{unicode_chars.source}-]{0,61}[a-zA-Z0-9#{unicode_chars.source}]\.#{general_domains.source}\z/ regexp = /\A[a-zA-Z0-9#{unicode_chars.source}][a-zA-Z0-9#{unicode_chars.source}-]{0,61}[a-zA-Z0-9#{unicode_chars.source}]\.#{general_domains.source}\z/
# rubocop: enable Metrics/LineLength
# rubocop: disable Style/DoubleNegation
!!(value =~ regexp) !!(value =~ regexp)
# rubocop: enable Style/DoubleNegation
end end
def validate_blocked(value) def validate_blocked(value)
return true unless value return true unless value
return false if BlockedDomain.where(name: value).count > 0 return false if BlockedDomain.where(name: value).count.positive?
DNS::Zone.where(origin: value).count.zero? DNS::Zone.where(origin: value).count.zero?
end end
end end

View file

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

View file

@ -57,8 +57,9 @@
%tbody %tbody
- @versions.each do |version| - @versions.each do |version|
- if version - if version
- contact = Contact.new(version.object.to_h) - attributes = only_present_fields(version, Contact)
- version.object_changes.to_h.each { |k,v| contact.public_send("#{k}=", v.last) } - contact = Contact.new(attributes)
- attach_existing_fields(version, contact)
%tr %tr
%td= link_to(contact.name, admin_contact_version_path(version.id)) %td= link_to(contact.name, admin_contact_version_path(version.id))

View file

@ -1,5 +1,6 @@
- contact = Contact.new(@version.object.to_h) - attributes = only_present_fields(@version, Contact)
- @version.object_changes.to_h.each { |k,v| contact.public_send("#{k}=", v.last ) } - contact = Contact.new(attributes)
- attach_existing_fields(@version, contact)
= render 'shared/title', name: contact.name = render 'shared/title', name: contact.name
.row .row
@ -41,11 +42,11 @@
%br %br
%dt= t(:created) %dt= t(:created_at)
%dd{class: changing_css_class(@version,"created_at")} %dd{class: changing_css_class(@version,"created_at")}
= l(contact.created_at, format: :short) = l(contact.created_at, format: :short)
%dt= t(:updated) %dt= t(:updated_at)
%dd{class: changing_css_class(@version,"updated_at")} %dd{class: changing_css_class(@version,"updated_at")}
= l(contact.updated_at, format: :short) = l(contact.updated_at, format: :short)
@ -61,7 +62,7 @@
- if contact.street.present? - if contact.street.present?
%dt= t(:street) %dt= t(:street)
%dd{class: changing_css_class(@version,"street")}= contact.street.to_s.gsub("\n", '<br>').html_safe %dd{class: changing_css_class(@version,"street")}= contact.street
- if contact.city.present? - if contact.city.present?
%dt= t(:city) %dt= t(:city)

View file

@ -55,8 +55,9 @@
%tbody %tbody
- @versions.each do |version| - @versions.each do |version|
- if version - if version
- domain = Domain.new(version.object.to_h) - attributes = only_present_fields(version, Domain)
- version.object_changes.to_h.each{|k,v| domain.public_send("#{k}=", v.last) } - domain = Domain.new(attributes)
- attach_existing_fields(version, domain)
%tr %tr
%td= link_to(domain.name, admin_domain_version_path(version.id)) %td= link_to(domain.name, admin_domain_version_path(version.id))

View file

@ -1,5 +1,6 @@
- domain = Domain.new(@version.object.to_h) - present_fields = only_present_fields(@version, Domain)
- @version.object_changes.to_h.each{|k,v| domain.public_send("#{k}=", v.last) } - domain = Domain.new(present_fields)
- attach_existing_fields(@version, domain)
- if @version - if @version
- children = HashWithIndifferentAccess.new(@version.children) - children = HashWithIndifferentAccess.new(@version.children)

View file

@ -99,6 +99,7 @@
= render 'setting_row', var: :registry_state = render 'setting_row', var: :registry_state
= render 'setting_row', var: :registry_zip = render 'setting_row', var: :registry_zip
= render 'setting_row', var: :registry_country_code = render 'setting_row', var: :registry_country_code
= render 'setting_row', var: :registry_whois_disclaimer
.row .row
.col-md-12.text-right .col-md-12.text-right

View file

@ -1,7 +1,11 @@
<% if flash[:notice] %> <% if flash[:notice] %>
<div class="alert alert-success alert-dismissible"> <div class="alert alert-success alert-dismissible">
<button class="close" data-dismiss="alert" type=button><span>&times;</span></button> <button class="close" data-dismiss="alert" type=button><span>&times;</span></button>
<p><%= flash[:notice] %></p> <% if flash[:notice].respond_to?(:join) %>
<p><%= flash[:notice].join('<br>').html_safe %></p>
<% else %>
<p><%= flash[:notice] %></p>
<% end %>
</div> </div>
<% end %> <% end %>

View file

@ -22,7 +22,7 @@ xml.epp_head do
xml.tag!('domain:contact', ac.code, 'type' => 'admin') xml.tag!('domain:contact', ac.code, 'type' => 'admin')
end end
if @nameservers && @nameservers.any? if @nameservers&.any?
xml.tag!('domain:ns') do xml.tag!('domain:ns') do
@nameservers.each do |x| @nameservers.each do |x|
xml.tag!('domain:hostAttr') do xml.tag!('domain:hostAttr') do

View file

@ -1,3 +1,6 @@
<%- if json['disclaimer'].present? -%>
<%= json['disclaimer'].scan(/\S.{0,72}\S(?=\s|$)|\S+/).join("\n") %>
<%- end -%>
Estonia .ee Top Level Domain WHOIS server Estonia .ee Top Level Domain WHOIS server
Domain: Domain:
@ -23,18 +26,18 @@ changed: <%= json['registrant_changed'].to_s.tr('T',' ').sub('+', ' +') %>
<%- if json['admin_contacts'].present? -%> <%- if json['admin_contacts'].present? -%>
Administrative contact: Administrative contact:
<%- for contact in json['admin_contacts'] -%> <%- for contact in json['admin_contacts'] -%>
name: <%= contact['name'] %> name: Not Disclosed
email: Not Disclosed - Visit www.internet.ee for webbased WHOIS email: Not Disclosed - Visit www.internet.ee for webbased WHOIS
changed: <%= contact['changed'].to_s.tr('T',' ').sub('+', ' +') %> changed: Not Disclosed
<%- end -%> <%- end -%>
<%- end -%> <%- end -%>
<% if json['tech_contacts'].present? %> <% if json['tech_contacts'].present? %>
Technical contact: Technical contact:
<%- for contact in json['tech_contacts'] -%> <%- for contact in json['tech_contacts'] -%>
name: <%= contact['name'] %> name: Not Disclosed
email: Not Disclosed - Visit www.internet.ee for webbased WHOIS email: Not Disclosed - Visit www.internet.ee for webbased WHOIS
changed: <%= contact['changed'].to_s.tr('T',' ').sub('+', ' +') %> changed: Not Disclosed
<%- end -%> <%- end -%>
<%- end -%> <%- end -%>

View file

@ -1,54 +0,0 @@
!!! 5
%html{lang: I18n.locale.to_s}
%head
%meta{charset: "utf-8"}/
%meta{content: "width=device-width, initial-scale=1", name: "viewport"}/
- if content_for? :head_title
= yield :head_title
- else
%title= t(:registrant_head_title)
= csrf_meta_tags
= stylesheet_link_tag 'registrant-manifest', media: 'all'
= favicon_link_tag 'favicon.ico'
%body
/ Fixed navbar
%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 registrant_root_path, class: 'navbar-brand' do
= t(:registrant_head_title)
- if unstable_env.present?
.text-center
%small{style: 'color: #0074B3;'}= unstable_env
- if current_user
.navbar-collapse.collapse
%ul.nav.navbar-nav.public-nav
- if can? :view, Depp::Domain
- active_class = %w(registrant/domains registrant/check registrant/renew registrant/tranfer registrant/keyrelays).include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:domains), registrant_domains_path
- active_class = %w(registrant/whois).include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:whois), registrant_whois_path
%ul.nav.navbar-nav.navbar-right
- if user_signed_in?
%li= link_to t(:log_out, user: current_user), '/registrant/logout'
.container
= render 'shared/flash'
= yield
%footer.footer
.container
.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

View file

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

View file

@ -18,7 +18,7 @@
<nav class="navbar navbar-default navbar-fixed-top"> <nav class="navbar navbar-default navbar-fixed-top">
<div class="container"> <div class="container">
<div class="navbar-header"> <div class="navbar-header">
<button aria-controls="navbar" aria-expanded="false" class="navbar-toggle collapsed" data-target="#navbar" data-toggle="collapse" type="button"> <button aria-expanded="false" class="navbar-toggle collapsed" data-target="#navbar" data-toggle="collapse" type="button">
<span class="sr-only">Toggle navigation</span> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
@ -39,7 +39,7 @@
</div> </div>
</nav> </nav>
<div class="container"> <div class="container">
<%= render 'shared/flash' %> <%= render 'flash_messages' %>
<% if depp_controller? %> <% if depp_controller? %>
<%= render 'registrar/shared/epp_results' %> <%= render 'registrar/shared/epp_results' %>
<% end %> <% end %>

View file

@ -1,45 +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'
= javascript_include_tag 'registrar-manifest'
= 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', id: 'registrar-home-btn' do
= t(:registrar_head_title)
- if unstable_env.present?
.text-center
%small{style: 'color: #0074B3;'}= unstable_env
- if current_user
= 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

View file

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html lang="<%= locale %>">
<head>
<meta charset="utf-8">
<% if content_for? :head_title %>
<%= yield :head_title %>
<% else %>
<title>
<%= t(:registrar_head_title) %>
</title>
<% end %>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'registrar-manifest', media: 'all' %>
<%= javascript_include_tag 'registrar-manifest' %>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<%= link_to registrar_root_path, class: 'navbar-brand',
id: 'registrar-home-btn' do %>
<%= t(:registrar_head_title) %>
<% if unstable_env.present? %>
<div class="text-center">
<small style="color: #0074B3;">
<%= unstable_env %>
</small>
</div>
<% end %>
<% end %>
</div>
</div>
</nav>
<div class="container">
<%= render 'flash_messages' %>
<%= yield %>
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-md-6">
<%= image_tag 'eis-logo-et.png' %>
</div>
<div class="col-md-6 text-right">
Version
<%= CURRENT_COMMIT_HASH %>
</div>
</div>
</div>
</footer>
</body>
</html>

View file

@ -8,7 +8,7 @@
%dd= @contact.org_name %dd= @contact.org_name
%dt= t(:street) %dt= t(:street)
%dd= @contact.street.to_s.gsub("\n", '<br>').html_safe %dd= @contact.street
%dt= t(:city) %dt= t(:city)
%dd= @contact.city %dd= @contact.city

View file

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

View file

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

View file

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

View file

@ -0,0 +1,34 @@
<%= form_tag registrar_domain_transfers_path, multipart: true, class: 'form-horizontal' do %>
<%= render 'registrar/domain_transfers/form/api_errors' %>
<div class="form-group">
<div class="col-md-2 control-label">
<%= label_tag :batch_file %>
</div>
<div class="col-md-4">
<%= file_field_tag :batch_file, required: true %>
<span class="help-block"><%= t '.file_field_hint' %></span>
</div>
</div>
<div class="form-group">
<div class="col-md-4 col-md-offset-2 text-right">
<button class="btn btn-warning">
<%= t '.submit_btn' %>
</button>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<a class="btn btn-default btn-xs" role="button" data-toggle="collapse"
href="#bulk_change_bulk_transfer_help"><%= t '.help_btn' %>
</a>
<div class="collapse" id="bulk_change_bulk_transfer_help">
<div class="well">
<%= t '.help' %>
</div>
</div>
</div>
</div>
<% end %>

View file

@ -1,12 +1,13 @@
<%= form_tag registrar_update_registrar_nameserver_path, method: :put, class: 'form-horizontal' do %> <%= form_tag registrar_nameservers_path, method: :patch, class: 'form-horizontal' do %>
<%= render 'registrar/domain_transfers/form/api_errors' %>
<div class="form-group"> <div class="form-group">
<div class="col-md-2 control-label"> <div class="col-md-2 control-label">
<%= label_tag :old_hostname %> <%= label_tag :old_hostname %>
</div> </div>
<div class="col-md-5"> <div class="col-md-4">
<%= text_field_tag :old_hostname, params[:old_hostname], autofocus: true, <%= text_field_tag :old_hostname, params[:old_hostname], required: true,
required: true,
class: 'form-control' %> class: 'form-control' %>
</div> </div>
</div> </div>
@ -16,7 +17,7 @@
<%= label_tag :new_hostname %> <%= label_tag :new_hostname %>
</div> </div>
<div class="col-md-5"> <div class="col-md-4">
<%= text_field_tag :new_hostname, params[:new_hostname], required: true, <%= text_field_tag :new_hostname, params[:new_hostname], required: true,
class: 'form-control' %> class: 'form-control' %>
</div> </div>
@ -27,7 +28,7 @@
<%= label_tag :ipv4 %> <%= label_tag :ipv4 %>
</div> </div>
<div class="col-md-3"> <div class="col-md-4">
<%= text_area_tag :ipv4, params[:ipv4], class: 'form-control' %> <%= text_area_tag :ipv4, params[:ipv4], class: 'form-control' %>
</div> </div>
</div> </div>
@ -37,17 +38,30 @@
<%= label_tag :ipv6 %> <%= label_tag :ipv6 %>
</div> </div>
<div class="col-md-3"> <div class="col-md-4">
<%= text_area_tag :ipv6, params[:ipv6], class: 'form-control' %> <%= text_area_tag :ipv6, params[:ipv6], class: 'form-control' %>
<span class="help-block"><%= t '.ip_hint' %></span> <span class="help-block"><%= t '.ip_hint' %></span>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-5 col-md-offset-2 text-right"> <div class="col-md-4 col-md-offset-2 text-right">
<button class="btn btn-warning"> <button class="btn btn-warning">
<%= t '.replace_btn' %> <%= t '.replace_btn' %>
</button> </button>
</div> </div>
</div> </div>
<div class="form-group">
<div class="col-md-6">
<a class="btn btn-default btn-xs" role="button" data-toggle="collapse"
href="#bulk_change_nameserver_help"><%= t '.help_btn' %>
</a>
<div class="collapse" id="bulk_change_nameserver_help">
<div class="well">
<%= t '.help' %>
</div>
</div>
</div>
</div>
<% end %> <% end %>

View file

@ -0,0 +1,60 @@
<%= form_tag registrar_tech_contacts_path, method: :patch, class: 'form-horizontal' do %>
<% if @error %>
<div class="alert alert-danger">
<%= @error[:message] %>
</div>
<% end %>
<div class="form-group">
<div class="col-md-2 control-label">
<%= label_tag :current_contact_id, t('.current_contact_id') %>
</div>
<div class="col-md-4">
<%= text_field_tag :current_contact_id, params[:current_contact_id],
list: :contacts,
required: true,
autofocus: true,
class: 'form-control' %>
</div>
</div>
<div class="form-group">
<div class="col-md-2 control-label">
<%= label_tag :new_contact_id, t('.new_contact_id') %>
</div>
<div class="col-md-4">
<%= text_field_tag :new_contact_id, params[:new_contact_id],
list: :contacts,
required: true,
class: 'form-control' %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 col-md-offset-2 text-right">
<button class="btn btn-warning">
<%= t '.submit_btn' %>
</button>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<a class="btn btn-default btn-xs" role="button" data-toggle="collapse"
href="#bulk_change_tech_contact_help"><%= t '.help_btn' %></a>
<div class="collapse" id="bulk_change_tech_contact_help">
<div class="well">
<%= t '.help' %>
</div>
</div>
</div>
</div>
<% end %>
<datalist id="contacts">
<% available_contacts.each do |data| %>
<option value="<%= data.second %>"><%= data.first %></option>
<% end %>
</datalist>

View file

@ -0,0 +1,37 @@
<ol class="breadcrumb">
<li><%= link_to t('registrar.domains.index.header'), registrar_domains_path %></li>
</ol>
<div class="page-header">
<h1><%= t '.header' %></h1>
</div>
<ul class="nav nav-tabs">
<li class="<%= 'active' if active_tab == :technical_contact %>">
<a href="#technical_contact" data-toggle="tab"><%= t '.technical_contact' %></a>
</li>
<li class="<%= 'active' if active_tab == :nameserver %>">
<a href="#nameserver" data-toggle="tab"><%= t '.nameserver' %></a>
</li>
<li class="<%= 'active' if active_tab == :bulk_transfer %>">
<a href="#bulk_transfer" data-toggle="tab"><%= t '.bulk_transfer' %></a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane<%= ' active' if active_tab == :technical_contact %>"
id="technical_contact">
<%= render 'tech_contact_form', available_contacts: available_contacts %>
</div>
<div class="tab-pane<%= ' active' if active_tab == :nameserver %>" id="nameserver">
<%= render 'nameserver_form' %>
</div>
<div class="tab-pane<%= ' active' if active_tab == :bulk_transfer %>" id="bulk_transfer">
<%= render 'bulk_transfer_form' %>
</div>
</div>

View file

@ -1,4 +1,6 @@
<%= form_tag registrar_domain_transfers_path, multipart: true, class: 'form-horizontal' do %> <%= form_tag registrar_domain_transfers_path, multipart: true, class: 'form-horizontal' do %>
<%= render 'registrar/domain_transfers/form/api_errors' %>
<div class="form-group"> <div class="form-group">
<div class="col-md-3 control-label"> <div class="col-md-3 control-label">
<%= label_tag :domain_name, nil, class: 'required' %> <%= label_tag :domain_name, nil, class: 'required' %>
@ -30,7 +32,7 @@
<div class="form-group"> <div class="form-group">
<div class="col-md-10 text-right"> <div class="col-md-10 text-right">
<button class="btn btn-warning"> <button class="btn btn-warning">
<%= t '.transfer_btn' %> <%= t '.submit_btn' %>
</button> </button>
</div> </div>
</div> </div>

View file

@ -1,19 +0,0 @@
<%= form_tag registrar_domain_transfers_path, multipart: true, class: 'form-horizontal' do %>
<div class="form-group">
<div class="col-md-3 control-label">
<%= label_tag :batch_file %>
</div>
<div class="col-md-7">
<%= file_field_tag :batch_file, required: true %>
<span class="help-block"><%= t '.batch_file_help' %></span>
</div>
</div>
<div class="form-group">
<div class="col-md-10 text-right">
<button class="btn btn-warning">
<%= t '.transfer_btn' %>
</button>
</div>
</div>
<% end %>

View file

@ -6,24 +6,6 @@
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
<ul class="nav nav-tabs"> <%= render 'form' %>
<li class="active">
<a href="#single" data-toggle="tab"><%= t '.single' %></a>
</li>
<li>
<a href="#batch" data-toggle="tab"><%= t '.batch' %></a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="single">
<%= render 'registrar/domain_transfers/form/single' %>
</div>
<div class="tab-pane" id="batch">
<%= render 'registrar/domain_transfers/form/batch' %>
</div>
</div>
</div> </div>
</div> </div>

View file

@ -1,13 +1,13 @@
<div class="page-header"> <div class="page-header">
<div class="row"> <div class="row">
<div class="col-sm-7"> <div class="col-sm-5">
<h1><%= t '.header' %></h1> <h1><%= t '.header' %></h1>
</div> </div>
<div class="col-sm-5 text-right"> <div class="col-sm-7 text-right">
<%= link_to t('.new_btn'), new_registrar_domain_path, class: 'btn btn-primary' %> <%= link_to t('.new_btn'), new_registrar_domain_path, class: 'btn btn-primary' %>
<%= link_to t('.transfer_btn'), new_registrar_domain_transfer_path, class: 'btn btn-default' %> <%= link_to t('.transfer_btn'), new_registrar_domain_transfer_path, class: 'btn btn-default' %>
<%= link_to t('.replace_nameserver_btn'), registrar_edit_registrar_nameserver_path, <%= link_to t('.bulk_change_btn'), new_registrar_bulk_change_path,
class: 'btn btn-default' %> class: 'btn btn-default' %>
</div> </div>
</div> </div>
@ -24,22 +24,22 @@
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-hover table-bordered table-condensed"> <table class="table table-hover table-bordered table-condensed">
<thead> <thead>
<tr> <tr>
<th class="col-xs-2"> <th class="col-xs-2">
<%= sort_link(@q, 'name') %> <%= sort_link(@q, 'name') %>
</th> </th>
<th class="col-xs-2"> <th class="col-xs-2">
<%= sort_link @q, 'registrant_name', Registrant.model_name.human %> <%= sort_link @q, 'registrant_name', Registrant.model_name.human %>
</th> </th>
<th class="col-xs-2"> <th class="col-xs-2">
<%= sort_link @q, 'valid_to', Domain.human_attribute_name(:expire_time) %> <%= sort_link @q, 'valid_to', Domain.human_attribute_name(:expire_time) %>
</th> </th>
<th class="col-xs-2"></th> <th class="col-xs-2"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<%= render @domains %> <%= render @domains %>
</tbody> </tbody>
</table> </table>
</div> </div>

View file

@ -1,6 +1,7 @@
%h4= t(:pay_by_bank_link) %h4= t('registrar.invoices.pay_invoice')
%hr %hr
- ENV['payments_banks'].split(",").each do |meth|
- locals[:payment_channels].each do |meth|
- meth = meth.strip - meth = meth.strip
= link_to registrar_payment_with_path(meth, invoice_id: params[:id]) do = link_to registrar_payment_with_path(meth, invoice_id: params[:id]) do
= image_tag("#{meth}.png") = image_tag("#{meth}.png")

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