mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 05:05:45 +02:00
Refactor confirmation url view in registrant area
This commit is contained in:
parent
aad39fd2b7
commit
1dfc618228
7 changed files with 32 additions and 20 deletions
|
@ -16,19 +16,19 @@ class Registrant::DomainsController < RegistrantController
|
||||||
authorize! :read, @domain
|
authorize! :read, @domain
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_verification_url
|
def confirmation
|
||||||
authorize! :view, :registrant_domains
|
authorize! :view, :registrant_domains
|
||||||
dom = current_user_domains.find(params[:id])
|
domain = current_user_domains.find(params[:id])
|
||||||
if (dom.statuses.include?(DomainStatus::PENDING_UPDATE) || dom.statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION)) &&
|
|
||||||
dom.pending_json.present?
|
|
||||||
|
|
||||||
@domain = dom
|
if (domain.statuses.include?(DomainStatus::PENDING_UPDATE) ||
|
||||||
confirm_path = get_confirm_path(dom.statuses)
|
domain.statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION)) &&
|
||||||
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
|
domain.pending_json.present?
|
||||||
|
|
||||||
|
@domain = domain
|
||||||
|
@confirmation_url = confirmation_url(domain)
|
||||||
else
|
else
|
||||||
flash[:warning] = I18n.t('available_verification_url_not_found')
|
flash[:warning] = I18n.t('available_verification_url_not_found')
|
||||||
redirect_to registrant_domain_path(dom.id)
|
redirect_to registrant_domain_path(domain)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,11 +63,11 @@ class Registrant::DomainsController < RegistrantController
|
||||||
params[:q][:valid_to_lteq] = ca_cache
|
params[:q][:valid_to_lteq] = ca_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_confirm_path(statuses)
|
def confirmation_url(domain)
|
||||||
if statuses.include?(DomainStatus::PENDING_UPDATE)
|
if domain.statuses.include?(DomainStatus::PENDING_UPDATE)
|
||||||
"#{ENV['registrant_url']}/registrant/domain_update_confirms"
|
registrant_domain_update_confirm_url(token: domain.registrant_verification_token)
|
||||||
elsif statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
elsif domain.statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||||
"#{ENV['registrant_url']}/registrant/domain_delete_confirms"
|
registrant_domain_delete_confirm_url(token: domain.registrant_verification_token)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -5,9 +5,9 @@
|
||||||
.col-md-12
|
.col-md-12
|
||||||
.panel.panel-default
|
.panel.panel-default
|
||||||
.panel-heading
|
.panel-heading
|
||||||
%h3.panel-title= t(:personal_domain_verification_url)
|
%h3.panel-title= t('.header')
|
||||||
.panel-body
|
.panel-body
|
||||||
.input-group.input-group-lg
|
.input-group.input-group-lg
|
||||||
%span#sizing-addon1.input-group-addon.glyphicon.glyphicon-link
|
%span#sizing-addon1.input-group-addon.glyphicon.glyphicon-link
|
||||||
%input.form-control{"aria-describedby" => "sizing-addon1", type: "text", value: @verification_url}
|
%input.form-control{"aria-describedby" => "sizing-addon1", type: "text", value: @confirmation_url}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
- if [DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE_CONFIRMATION].include?(status) && @domain.pending_json.present?
|
- if [DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE_CONFIRMATION].include?(status) && @domain.pending_json.present?
|
||||||
= link_to(status, domain_verification_url_registrant_domain_url(@domain.id))
|
= link_to(status, confirmation_registrant_domain_path(@domain))
|
||||||
- else
|
- else
|
||||||
= status
|
= status
|
||||||
%td= @domain.status_notes[status]
|
%td= @domain.status_notes[status]
|
||||||
|
|
|
@ -675,7 +675,6 @@ en:
|
||||||
contact_is_not_valid: 'Contact %{value} is not valid, please fix the invalid contact'
|
contact_is_not_valid: 'Contact %{value} is not valid, please fix the invalid contact'
|
||||||
next: 'Next'
|
next: 'Next'
|
||||||
previous: 'Previous'
|
previous: 'Previous'
|
||||||
personal_domain_verification_url: 'Personal domain verification url'
|
|
||||||
available_verification_url_not_found: 'Available verification url not found, for domain.'
|
available_verification_url_not_found: 'Available verification url not found, for domain.'
|
||||||
add_reserved_domain: 'Add domain to reserved list'
|
add_reserved_domain: 'Add domain to reserved list'
|
||||||
add_blocked_domain: 'Add domain to blocked list'
|
add_blocked_domain: 'Add domain to blocked list'
|
||||||
|
|
|
@ -15,4 +15,6 @@ en:
|
||||||
|
|
||||||
domain_contacts:
|
domain_contacts:
|
||||||
header_admin_domain_contacts: Administrative contacts
|
header_admin_domain_contacts: Administrative contacts
|
||||||
header_tech_domain_contacts: Technical contacts
|
header_tech_domain_contacts: Technical contacts
|
||||||
|
confirmation:
|
||||||
|
header: Personal domain verification url
|
|
@ -156,7 +156,7 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
member do
|
member do
|
||||||
get 'domain_verification_url'
|
get 'confirmation'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -62,4 +62,15 @@ class RegistrantAreaDomainDetailsTest < ApplicationSystemTestCase
|
||||||
assert_no_text 'metro.test'
|
assert_no_text 'metro.test'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_confirmation_url
|
||||||
|
@domain.update!(registrant_verification_token: 'a01',
|
||||||
|
pending_json: { new_registrant_email: 'any' },
|
||||||
|
statuses: [DomainStatus::PENDING_UPDATE])
|
||||||
|
|
||||||
|
visit registrant_domain_url(@domain)
|
||||||
|
click_on 'pendingUpdate'
|
||||||
|
|
||||||
|
assert_field nil, with: registrant_domain_update_confirm_url(@domain, token: 'a01')
|
||||||
|
end
|
||||||
end
|
end
|
Loading…
Add table
Add a link
Reference in a new issue