Merge branch 'master' of github.com:domify/registry

Conflicts:
	CHANGELOG.md
	app/mailers/domain_mailer.rb
	app/models/domain.rb
	app/views/layouts/registrant/application.haml
	config/application-example.yml
	config/locales/en.yml
	config/routes.rb
	spec/mailers/domain_mailer_spec.rb
This commit is contained in:
Martin Lensment 2015-05-14 18:01:06 +03:00
commit 412ececd9c
13 changed files with 82 additions and 25 deletions

View file

@ -1,3 +1,7 @@
14.05.2015
* Changed and added some new smtp enviroment variables. More info at application-example.yml
13.05.2015 13.05.2015
* Added Registrant portal and apache config example * Added Registrant portal and apache config example

View file

@ -0,0 +1,5 @@
class Registrant::WhoisController < RegistrantController
def index
authorize! :view, Registrant::Whois
end
end

View file

@ -1,18 +1,18 @@
class DomainMailer < ApplicationMailer class DomainMailer < ApplicationMailer
def registrant_updated(domain) 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 # turn on delivery on specific request only, thus rake tasks does not deliver anything
return if domain.deliver_emails != true return if @domain.deliver_emails != true
if domain.registrant_verification_token.blank? if @domain.registrant_verification_token.blank?
logger.warn "EMAIL DID NOT DELIVERED: registrant_verification_token is missing for #{@domain.name}" logger.warn "EMAIL DID NOT DELIVERED: registrant_verification_token is missing for #{@domain.name}"
return return
end end
@old_registrant = Registrant.find(domain.registrant_id_was) @old_registrant = Registrant.find(@domain.registrant_id_was)
@verification_url = "#{ENV['registrant_url']}/etc/" @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}]") subject: "#{I18n.t(:domain_registrant_update_subject, name: @domain.name)} [#{@domain.name}]")
end end
end end

View file

@ -13,6 +13,7 @@ class Ability
when 'ApiUser' when 'ApiUser'
epp epp
registrar registrar
registrant # refactor
end end
can :show, :dashboard can :show, :dashboard
@ -63,6 +64,10 @@ class Ability
can :manage, :deposit can :manage, :deposit
end end
def registrant
can :manage, Registrant::Whois
end
def user def user
can :show, :dashboard can :show, :dashboard
end end

View file

@ -60,9 +60,10 @@ class Domain < ActiveRecord::Base
def manage_statuses def manage_statuses
return unless registrant_id_changed? return unless registrant_id_changed?
if registrant_verification_asked_at.present? 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 DomainMailer.registrant_updated(self).deliver_now
end end
true
end end
before_save :touch_always_version before_save :touch_always_version
@ -140,8 +141,8 @@ class Domain < ActiveRecord::Base
def included def included
includes( includes(
:registrant, :registrant,
:registrar, :registrar,
:nameservers, :nameservers,
:whois_record, :whois_record,
{ tech_contacts: :registrar }, { tech_contacts: :registrar },
{ admin_contacts: :registrar } { admin_contacts: :registrar }
@ -253,7 +254,7 @@ class Domain < ActiveRecord::Base
end end
# otherwise domain_statuses are in old state for domain object # otherwise domain_statuses are in old state for domain object
domain_statuses.reload domain_statuses.reload
end end
def children_log def children_log

View file

@ -36,6 +36,9 @@
- active_class = %w(registrant/domains registrant/check registrant/renew registrant/tranfer registrant/keyrelays).include?(params[:controller]) ? 'active' :nil - 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{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 %ul.nav.navbar-nav.navbar-right
- if user_signed_in? - if user_signed_in?
%li= link_to t(:log_out, user: current_user), '/registrant/logout' %li= link_to t(:log_out, user: current_user), '/registrant/logout'

View file

@ -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
&nbsp;
%span.glyphicon.glyphicon-search
&nbsp;
%hr
- if @results
= @results

View file

@ -35,12 +35,23 @@ key_path: '/home/registry/registry/shared/ca/private/webclient.key.pem'
epp_hostname: 'registry.gitlab.eu' epp_hostname: 'registry.gitlab.eu'
repp_url: 'https://repp.gitlab.eu/repp/v1/' 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) # SMTP configuration (for Admin/EPP/Registrar/Registrant servers)
address: 'server-hostname' smtp_address: 'server-hostname'
port: '000' smtp_port: '25' # 587, 465
user_name: 'login' smtp_user_name: 'login'
password: 'pw/key' smtp_password: 'pw/key'
domain: 'domain for HELO checking' # 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 registrant_url: 'https:/registrant.example.com' # for valid email body registrant links
# Autotest config overwrites # Autotest config overwrites

View file

@ -60,13 +60,14 @@ module Registry
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = { config.action_mailer.smtp_settings = {
address: ENV['address'], address: ENV['smtp_address'],
port: ENV['port'], port: ENV['smtp_port'],
enable_starttls_auto: true, enable_starttls_auto: ENV['smtp_enable_starttls_auto'] == 'true',
user_name: ENV['user_name'], user_name: ENV['smtp_user_name'],
password: ENV['password'], password: ENV['smtp_password'],
authentication: 'login', authentication: ENV['smtp_authentication'],
domain: ENV['domain'] domain: ENV['smtp_domain'],
openssl_verify_mode: ENV['smtp_openssl_verify_mode']
} }
end end
end end

View file

@ -766,3 +766,4 @@ en:
contact_email_update_subject: 'Teie domeenide kontakt epostiaadress on muutunud / Contact e-mail addresses of your domains have changed' 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' 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}" domain_registrant_update_subject: "Kinnitustaotlus domeeni %{name} registreerija vahetuseks / Application for approval for registrant chache of %{name}"
whois: WHOIS

View file

@ -191,7 +191,7 @@ common: &default_settings
development: development:
<<: *default_settings <<: *default_settings
# Turn on communication to New Relic service in development mode # Turn on communication to New Relic service in development mode
monitor_mode: true monitor_mode: false
app_name: Registry (Development) app_name: Registry (Development)
# Rails Only - when running in Developer Mode, the New Relic Agent will # Rails Only - when running in Developer Mode, the New Relic Agent will
@ -199,7 +199,7 @@ development:
# executed since starting the mongrel. # executed since starting the mongrel.
# NOTE: There is substantial overhead when running in developer mode. # NOTE: There is substantial overhead when running in developer mode.
# Do not use for production or load testing. # Do not use for production or load testing.
developer_mode: true developer_mode: false
test: test:
<<: *default_settings <<: *default_settings

View file

@ -126,6 +126,7 @@ Rails.application.routes.draw do
end end
end end
resources :whois
# resources :contacts do # resources :contacts do
# member do # member do
# get 'delete' # get 'delete'

View file

@ -31,6 +31,10 @@ describe DomainMailer do
@new_registrant = Fabricate(:registrant, email: 'test@example.org') @new_registrant = Fabricate(:registrant, email: 'test@example.org')
@domain = Fabricate(:domain, registrant: @registrant) @domain = Fabricate(:domain, registrant: @registrant)
@domain.deliver_emails = true @domain.deliver_emails = true
<<<<<<< HEAD
=======
@domain.registrant_verification_token = '123'
>>>>>>> 0ddd2b6f32fa7e9abec8b2e7c88173585a78f3dd
@domain.registrant = @new_registrant @domain.registrant = @new_registrant
@mail = DomainMailer.registrant_updated(@domain) @mail = DomainMailer.registrant_updated(@domain)
end end