diff --git a/CHANGELOG.md b/CHANGELOG.md index c66bfc501..31d09adbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +14.05.2015 + +* Changed and added some new smtp enviroment variables. More info at application-example.yml + 13.05.2015 * Added Registrant portal and apache config example diff --git a/app/controllers/registrant/whois_controller.rb b/app/controllers/registrant/whois_controller.rb new file mode 100644 index 000000000..3e437fe5d --- /dev/null +++ b/app/controllers/registrant/whois_controller.rb @@ -0,0 +1,5 @@ +class Registrant::WhoisController < RegistrantController + def index + authorize! :view, Registrant::Whois + end +end diff --git a/app/mailers/domain_mailer.rb b/app/mailers/domain_mailer.rb index 395537d8f..937ff3a4e 100644 --- a/app/mailers/domain_mailer.rb +++ b/app/mailers/domain_mailer.rb @@ -1,18 +1,18 @@ class DomainMailer < ApplicationMailer def registrant_updated(domain) - return if Rails.env.production? ? false : !TEST_EMAILS.include?(domain.registrant_email) + @domain = domain + return if Rails.env.production? ? false : !TEST_EMAILS.include?(@domain.registrant_email) # turn on delivery on specific request only, thus rake tasks does not deliver anything - return if domain.deliver_emails != true - if domain.registrant_verification_token.blank? + return if @domain.deliver_emails != true + if @domain.registrant_verification_token.blank? logger.warn "EMAIL DID NOT DELIVERED: registrant_verification_token is missing for #{@domain.name}" - return + return end - @old_registrant = Registrant.find(domain.registrant_id_was) + @old_registrant = Registrant.find(@domain.registrant_id_was) @verification_url = "#{ENV['registrant_url']}/etc/" - @domain = domain - mail(to: @old_registrant.email, + mail(to: @old_registrant.email, subject: "#{I18n.t(:domain_registrant_update_subject, name: @domain.name)} [#{@domain.name}]") end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 38d50e9df..38ddd5893 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -13,6 +13,7 @@ class Ability when 'ApiUser' epp registrar + registrant # refactor end can :show, :dashboard @@ -63,6 +64,10 @@ class Ability can :manage, :deposit end + def registrant + can :manage, Registrant::Whois + end + def user can :show, :dashboard end diff --git a/app/models/domain.rb b/app/models/domain.rb index f1af1213f..1aa845ca4 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -60,9 +60,10 @@ class Domain < ActiveRecord::Base def manage_statuses return unless registrant_id_changed? if registrant_verification_asked_at.present? - domain_statuses.build(value: DomainStatus::PENDING_UPDATE) + domain_statuses.build(value: DomainStatus::PENDING_UPDATE) DomainMailer.registrant_updated(self).deliver_now end + true end before_save :touch_always_version @@ -140,8 +141,8 @@ class Domain < ActiveRecord::Base def included includes( :registrant, - :registrar, - :nameservers, + :registrar, + :nameservers, :whois_record, { tech_contacts: :registrar }, { admin_contacts: :registrar } @@ -253,7 +254,7 @@ class Domain < ActiveRecord::Base end # otherwise domain_statuses are in old state for domain object - domain_statuses.reload + domain_statuses.reload end def children_log diff --git a/app/views/layouts/registrant/application.haml b/app/views/layouts/registrant/application.haml index beb6e4336..0269f3714 100644 --- a/app/views/layouts/registrant/application.haml +++ b/app/views/layouts/registrant/application.haml @@ -36,6 +36,9 @@ - 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' diff --git a/app/views/registrant/whois/index.haml b/app/views/registrant/whois/index.haml new file mode 100644 index 000000000..3e390eaf3 --- /dev/null +++ b/app/views/registrant/whois/index.haml @@ -0,0 +1,21 @@ += render 'shared/title', name: t(:whois) + +- if ENV['restful_whois_url'].blank? + %p + Registrant configuration issue: missing restful_whois_url +- else + .row + .col-md-12{style: 'margin-bottom: -15px;'} + = form_tag registrant_whois_path, class: 'form-horizontal', method: :get do + .col-md-11 + .form-group + = text_field_tag :domain_name, params[:domain_name], class: 'form-control', placeholder: t(:domain_name), autocomplete: 'off', autofocus: true + .col-md-1.text-right.text-center-xs + .form-group + %button.btn.btn-default +   + %span.glyphicon.glyphicon-search +   + %hr + - if @results + = @results diff --git a/config/application-example.yml b/config/application-example.yml index 2e88b86e1..22760ee47 100644 --- a/config/application-example.yml +++ b/config/application-example.yml @@ -35,12 +35,23 @@ key_path: '/home/registry/registry/shared/ca/private/webclient.key.pem' epp_hostname: 'registry.gitlab.eu' repp_url: 'https://repp.gitlab.eu/repp/v1/' +# Registrant server configuration +restful_whois_url: 'https://restful-whois.example.com' + # SMTP configuration (for Admin/EPP/Registrar/Registrant servers) -address: 'server-hostname' -port: '000' -user_name: 'login' -password: 'pw/key' -domain: 'domain for HELO checking' +smtp_address: 'server-hostname' +smtp_port: '25' # 587, 465 +smtp_user_name: 'login' +smtp_password: 'pw/key' +# If you need to specify a HELO domain, you can do it here. +smtp_domain: '' # 'domain for HELO checking' +# Use "none" only when for a self-signed and/or wildcard certificate +smtp_openssl_verify_mode: 'peer' # 'none', 'peer', 'client_once','fail_if_no_peer_cert' +# Detects if STARTTLS is enabled in your SMTP server and starts to use it. Defaults to true. +# Set this to false if there is a problem with your server certificate that you cannot resolve. +smtp_enable_starttls_auto: 'true' # 'false' +# If your mail server requires authentication, please change. +smtp_authentication: 'plain' # 'plain', 'login', 'cram_md5' registrant_url: 'https:/registrant.example.com' # for valid email body registrant links # Autotest config overwrites diff --git a/config/application.rb b/config/application.rb index fb5c768b0..4685fc1b7 100644 --- a/config/application.rb +++ b/config/application.rb @@ -60,13 +60,14 @@ module Registry config.action_mailer.raise_delivery_errors = true config.action_mailer.smtp_settings = { - address: ENV['address'], - port: ENV['port'], - enable_starttls_auto: true, - user_name: ENV['user_name'], - password: ENV['password'], - authentication: 'login', - domain: ENV['domain'] + address: ENV['smtp_address'], + port: ENV['smtp_port'], + enable_starttls_auto: ENV['smtp_enable_starttls_auto'] == 'true', + user_name: ENV['smtp_user_name'], + password: ENV['smtp_password'], + authentication: ENV['smtp_authentication'], + domain: ENV['smtp_domain'], + openssl_verify_mode: ENV['smtp_openssl_verify_mode'] } end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 8b9963538..1da48fa9f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -766,3 +766,4 @@ en: contact_email_update_subject: 'Teie domeenide kontakt epostiaadress on muutunud / Contact e-mail addresses of your domains have changed' object_status_prohibits_operation: 'Object status prohibits operation' domain_registrant_update_subject: "Kinnitustaotlus domeeni %{name} registreerija vahetuseks / Application for approval for registrant chache of %{name}" + whois: WHOIS diff --git a/config/newrelic.yml b/config/newrelic.yml index b99409dc9..6dc617a9d 100644 --- a/config/newrelic.yml +++ b/config/newrelic.yml @@ -191,7 +191,7 @@ common: &default_settings development: <<: *default_settings # Turn on communication to New Relic service in development mode - monitor_mode: true + monitor_mode: false app_name: Registry (Development) # Rails Only - when running in Developer Mode, the New Relic Agent will @@ -199,7 +199,7 @@ development: # executed since starting the mongrel. # NOTE: There is substantial overhead when running in developer mode. # Do not use for production or load testing. - developer_mode: true + developer_mode: false test: <<: *default_settings diff --git a/config/routes.rb b/config/routes.rb index 032368f00..f88f7aabb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -126,6 +126,7 @@ Rails.application.routes.draw do end end + resources :whois # resources :contacts do # member do # get 'delete' diff --git a/spec/mailers/domain_mailer_spec.rb b/spec/mailers/domain_mailer_spec.rb index ac83b0732..3fcffa1dc 100644 --- a/spec/mailers/domain_mailer_spec.rb +++ b/spec/mailers/domain_mailer_spec.rb @@ -31,6 +31,10 @@ describe DomainMailer do @new_registrant = Fabricate(:registrant, email: 'test@example.org') @domain = Fabricate(:domain, registrant: @registrant) @domain.deliver_emails = true +<<<<<<< HEAD +======= + @domain.registrant_verification_token = '123' +>>>>>>> 0ddd2b6f32fa7e9abec8b2e7c88173585a78f3dd @domain.registrant = @new_registrant @mail = DomainMailer.registrant_updated(@domain) end