diff --git a/app/controllers/registrant/domains_controller.rb b/app/controllers/registrant/domains_controller.rb index 0d8ffa5c5..14a961aba 100644 --- a/app/controllers/registrant/domains_controller.rb +++ b/app/controllers/registrant/domains_controller.rb @@ -19,6 +19,22 @@ class Registrant::DomainsController < RegistrantController @domain = domains.find(params[:id]) end + def domain_verification_url + authorize! :view, :registrant_domains + dom = domains.find(params[:id]) + if (dom.statuses.include?(DomainStatus::PENDING_UPDATE) || dom.statuses.include?(DomainStatus::PENDING_DELETE)) && + dom.pending_json.present? + + @domain = dom + confirm_path = "#{ENV['registrant_url']}/registrant/domain_update_confirms" + @verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}" + + else + flash[:warning] = I18n.t('available_verification_url_not_found') + redirect_to registrant_domain_path(dom.id) + end + end + def download_list authorize! :view, :registrant_domains params[:q] ||= {} diff --git a/app/controllers/registrant/registrants_controller.rb b/app/controllers/registrant/registrants_controller.rb index adc1e0b82..b395131ea 100644 --- a/app/controllers/registrant/registrants_controller.rb +++ b/app/controllers/registrant/registrants_controller.rb @@ -2,6 +2,7 @@ class Registrant::RegistrantsController < RegistrantController def show @contact = Registrant.find(params[:id]) + @current_user = current_user authorize! :read, @contact @contact.valid? end diff --git a/app/models/contact.rb b/app/models/contact.rb index ad5a03400..5b7bdf862 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -460,7 +460,6 @@ class Contact < ActiveRecord::Base domains.each{|d| d.roles = domain_c[d.id].uniq} domains end - [] end def set_linked diff --git a/app/views/registrant/domains/domain_verification_url.haml b/app/views/registrant/domains/domain_verification_url.haml new file mode 100644 index 000000000..f75091a2e --- /dev/null +++ b/app/views/registrant/domains/domain_verification_url.haml @@ -0,0 +1,13 @@ +- content_for :actions do + = render 'shared/title', name: @domain.name + +.row + .col-md-12 + .panel.panel-default + .panel-heading + %h3.panel-title= t(:personal_domain_verification_url) + .panel-body + .input-group.input-group-lg + %span#sizing-addon1.input-group-addon.glyphicon.glyphicon-link + %input.form-control{"aria-describedby" => "sizing-addon1", type: "text", value: @verification_url} + diff --git a/app/views/registrant/domains/partials/_statuses.haml b/app/views/registrant/domains/partials/_statuses.haml index ab8e55e6c..0aa5b1e6f 100644 --- a/app/views/registrant/domains/partials/_statuses.haml +++ b/app/views/registrant/domains/partials/_statuses.haml @@ -11,8 +11,8 @@ - @domain.statuses.each do |status| %tr %td - - if @domain.pending_json.present? && [DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE].include?(status) - = link_to status, admin_domain_domain_versions_path(@domain.id) + - if [DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE].include?(status) && @domain.pending_json.present? + = link_to(status, domain_verification_url_registrant_domain_url(@domain.id)) - else = status %td= @domain.status_notes[status] diff --git a/app/views/registrant/registrants/partials/_domains.haml b/app/views/registrant/registrants/partials/_domains.haml index e528a331d..0bbe55c91 100644 --- a/app/views/registrant/registrants/partials/_domains.haml +++ b/app/views/registrant/registrants/partials/_domains.haml @@ -1,4 +1,4 @@ -- domains = contact.all_registrant_domains(page: params[:domain_page], per: 20, params: params, current_user: current_user) +- domains = contact.all_registrant_domains(page: params[:domain_page], per: 20, params: params, registrant: current_user) #contacts.panel.panel-default .panel-heading .pull-left diff --git a/config/locales/en.yml b/config/locales/en.yml index 26822ab0c..de80b8f0e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -937,3 +937,5 @@ en: edit_pw: 'Edit Pw' optional: 'Optional' contact_already_associated_with_the_domain: 'Object association prohibits operation, contact already associated with the domain' + personal_domain_verification_url: 'Personal domain verification url' + available_verification_url_not_found: 'Available verification url not found, for domain.' diff --git a/config/routes.rb b/config/routes.rb index ec4264462..2a61d54f9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -107,6 +107,11 @@ Rails.application.routes.draw do collection do get :download_list end + + member do + get 'domain_verification_url' + end + end # resources :invoices do