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

Conflicts:
	config/locales/en.yml
	db/schema.rb
This commit is contained in:
Martin Lensment 2015-05-19 17:26:32 +03:00
commit 2fb632b7a9
21 changed files with 298 additions and 54 deletions

View file

@ -0,0 +1,12 @@
class Registrant::DomainDeleteConfirmsController < RegistrantController
skip_before_action :authenticate_user!, only: [:show, :create]
skip_authorization_check only: [:show, :create]
def show
@domain = Domain.find(params[:id])
@domain = nil unless @domain.registrant_delete_confirmable?(params[:token])
end
def create
end
end

View file

@ -1,12 +1,40 @@
class Registrant::DomainUpdateConfirmsController < RegistrantController
skip_before_action :authenticate_user!, only: [:show, :create]
skip_authorization_check only: [:show, :create]
skip_before_action :authenticate_user!, only: [:show, :update]
skip_authorization_check only: [:show, :update]
def show
return if params[:confirmed] || params[:rejected]
@domain = Domain.find(params[:id])
@domain = nil unless @domain.registrant_update_confirmable?(params[:token])
end
def create
def update
@domain = Domain.find(params[:id])
unless @domain.registrant_update_confirmable?(params[:token])
flash[:alert] = t(:registrant_domain_verification_failed)
return render 'show'
end
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
domain_name: @domain.name,
verification_token: params[:token])
if params[:rejected]
if @registrant_verification.domain_registrant_change_reject!
flash[:notice] = t(:registrant_domain_verification_rejected)
redirect_to registrant_domain_update_confirm_path(@domain.id, rejected: true)
else
flash[:alert] = t(:registrant_domain_verification_rejected_failed)
return render 'show'
end
elsif params[:confirmed]
if @registrant_verification.domain_registrant_change_confirm!
flash[:notice] = t(:registrant_domain_verification_confirmed)
redirect_to registrant_domain_update_confirm_path(@domain.id, confirmed: true)
else
flash[:alert] = t(:registrant_domain_verification_confirmed_failed)
return render 'show'
end
end
end
end

View file

@ -1,46 +1,48 @@
class Registrar::NameserversController < RegistrarController
load_and_authorize_resource
# turned off requested by client
def index
if can_replace_hostnames?
prc = Nameserver.replace_hostname_ends(
current_user.registrar.domains.includes(
:registrant, :nameservers, :admin_domain_contacts, :tech_domain_contacts, :domain_statuses,
:versions, :admin_contacts, :tech_contacts, :whois_record, :dnskeys
),
params[:q][:hostname_end],
params[:hostname_end_replacement]
)
# load_and_authorize_resource
if prc == 'replaced_none'
flash.now[:alert] = t(:no_hostnames_replaced)
elsif prc == 'replaced_all'
params[:q][:hostname_end] = params[:hostname_end_replacement]
params[:hostname_end_replacement] = nil
flash.now[:notice] = t(:all_hostnames_replaced)
else
flash.now[:warning] = t(:hostnames_partially_replaced)
end
end
# def index
# if can_replace_hostnames?
# prc = Nameserver.replace_hostname_ends(
# current_user.registrar.domains.includes(
# :registrant, :nameservers, :admin_domain_contacts, :tech_domain_contacts, :domain_statuses,
# :versions, :admin_contacts, :tech_contacts, :whois_record, :dnskeys
# ),
# params[:q][:hostname_end],
# params[:hostname_end_replacement]
# )
nameservers = current_user.registrar.nameservers.includes(:domain)
@q = nameservers.search(params[:q])
@q.sorts = 'id desc' if @q.sorts.empty?
@nameservers = @q.result.page(params[:page])
end
# if prc == 'replaced_none'
# flash.now[:alert] = t(:no_hostnames_replaced)
# elsif prc == 'replaced_all'
# params[:q][:hostname_end] = params[:hostname_end_replacement]
# params[:hostname_end_replacement] = nil
# flash.now[:notice] = t(:all_hostnames_replaced)
# else
# flash.now[:warning] = t(:hostnames_partially_replaced)
# end
# end
def replace_all
@domain_params = { nameservers_attributes: { 0 => {} } }
end
# nameservers = current_user.registrar.nameservers.includes(:domain)
# @q = nameservers.search(params[:q])
# @q.sorts = 'id desc' if @q.sorts.empty?
# @nameservers = @q.result.page(params[:page])
# end
private
# def replace_all
# @domain_params = { nameservers_attributes: { 0 => {} } }
# end
def can_replace_hostnames?
if params[:replace] && params[:q]
flash.now[:alert] = t('hostname_end_replacement_is_required') unless params[:hostname_end_replacement].present?
flash.now[:alert] = t('hostname_end_is_required') unless params[:q][:hostname_end].present?
return true if flash[:alert].blank?
end
false
end
# private
# def can_replace_hostnames?
# if params[:replace] && params[:q]
# flash.now[:alert] = t('hostname_end_replacement_is_required') unless params[:hostname_end_replacement].present?
# flash.now[:alert] = t('hostname_end_is_required') unless params[:q][:hostname_end].present?
# return true if flash[:alert].blank?
# end
# false
# end
end