diff --git a/app/controllers/registrant/contacts_controller.rb b/app/controllers/registrant/contacts_controller.rb deleted file mode 100644 index 49070ebde..000000000 --- a/app/controllers/registrant/contacts_controller.rb +++ /dev/null @@ -1,115 +0,0 @@ -class Registrant::ContactsController < RegistrantController - helper_method :domain - helper_method :fax_enabled? - helper_method :domain_filter_params - skip_authorization_check only: %i[edit update] - before_action :set_contact, only: [:show] - - def show - @requester_contact = Contact.find_by(ident: current_registrant_user.ident) - authorize! :read, @contact - end - - def edit - @contact = current_user_contacts.find(params[:id]) - end - - def update - @contact = current_user_contacts.find(params[:id]) - @contact.attributes = contact_params - response = update_contact_via_api(@contact.uuid) - updated = response.is_a?(Net::HTTPSuccess) - - if updated - redirect_to registrant_domain_contact_url(domain, @contact), notice: t('.updated') - else - parsed_response = JSON.parse(response.body, symbolize_names: true) - @errors = parsed_response[:errors] - render :edit - end - end - - private - - def set_contact - id = params[:id] - contact = domain.contacts.find_by(id: id) || current_user_contacts.find_by(id: id) - contact ||= Contact.find_by(id: id, ident: domain.registrant.ident) - @contact = contact - end - - def domain - current_user_domains.find(params[:domain_id]) - end - - def contact_params - permitted = %i[ - name - email - phone - ] - - permitted << :fax if fax_enabled? - permitted += %i[street zip city state country_code] if Contact.address_processing? - params.require(:contact).permit(*permitted) - end - - def access_token - uri = URI.parse("#{ENV['registrant_api_base_url']}/api/v1/registrant/auth/eid") - request = Net::HTTP::Post.new(uri) - request.form_data = access_token_request_params - - response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: (uri.scheme == 'https')) do |http| - http.request(request) - end - - json_doc = JSON.parse(response.body, symbolize_names: true) - json_doc[:access_token] - end - - def access_token_request_params - { ident: current_registrant_user.ident, - first_name: current_registrant_user.first_name, - last_name: current_registrant_user.last_name } - end - - def fax_enabled? - ENV['fax_enabled'] == 'true' - end - - def contact_update_api_params - params = contact_params - params = normalize_address_attributes_for_api(params) if Contact.address_processing? - params - end - - def normalize_address_attributes_for_api(params) - normalized = params - address_parts = {} - - Contact.address_attribute_names.each do |attr| - attr = attr.to_sym - address_parts[attr] = params[attr] - normalized.delete(attr) - end - - normalized[:address] = address_parts - normalized - end - - def update_contact_via_api(uuid) - uri = URI.parse("#{ENV['registrant_api_base_url']}/api/v1/registrant/contacts/#{uuid}") - request = Net::HTTP::Patch.new(uri) - request['Authorization'] = "Bearer #{access_token}" - request['Content-type'] = 'application/json' - request.body = contact_update_api_params.to_json - - Net::HTTP.start(uri.hostname, uri.port, use_ssl: (uri.scheme == 'https')) do |http| - http.request(request) - end - end - - def domain_filter_params - params.permit(:domain_filter) - end -end diff --git a/app/controllers/registrant/domain_delete_confirms_controller.rb b/app/controllers/registrant/domain_delete_confirms_controller.rb deleted file mode 100644 index 337ca2403..000000000 --- a/app/controllers/registrant/domain_delete_confirms_controller.rb +++ /dev/null @@ -1,44 +0,0 @@ -class Registrant::DomainDeleteConfirmsController < RegistrantController - skip_before_action :authenticate_registrant_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_delete_confirmable?(params[:token]) - end - - def update - @domain = Domain.find(params[:id]) - unless @domain.registrant_delete_confirmable?(params[:token]) - flash[:alert] = t(:registrant_domain_verification_failed) - return render 'show' - end - - @registrant_verification = RegistrantVerification.new(domain_id: @domain.id, - verification_token: params[:token]) - - initiator = current_registrant_user ? current_registrant_user.username : - t(:user_not_authenticated) - - confirmed = params[:confirmed] ? true : false - action = if confirmed - @registrant_verification.domain_registrant_delete_confirm!("email link #{initiator}") - else - @registrant_verification.domain_registrant_delete_reject!("email link #{initiator}") - end - - fail_msg = t("registrant_domain_delete_#{confirmed ? 'confirmed' : 'rejected'}_failed".to_sym) - success_msg = t("registrant_domain_verification_#{confirmed ? 'confirmed' : 'rejected'}".to_sym) - - flash[:alert] = action ? success_msg : fail_msg - (render 'show' && return) unless action - - if confirmed - redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true) - else - redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true) - end - end -end diff --git a/app/controllers/registrant/domain_update_confirms_controller.rb b/app/controllers/registrant/domain_update_confirms_controller.rb deleted file mode 100644 index 0e4f2a582..000000000 --- a/app/controllers/registrant/domain_update_confirms_controller.rb +++ /dev/null @@ -1,44 +0,0 @@ -class Registrant::DomainUpdateConfirmsController < RegistrantController - skip_before_action :authenticate_registrant_user!, only: %i[show update] - skip_authorization_check only: %i[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 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, - verification_token: params[:token]) - - initiator = current_registrant_user ? current_registrant_user.username : - t(:user_not_authenticated) - - if params[:rejected] - if @registrant_verification.domain_registrant_change_reject!("email link, #{initiator}") - 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!("email link, #{initiator}") - Dispute.close_by_domain(@domain.name) if @domain.disputed? - - 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 diff --git a/app/controllers/registrant/domains_controller.rb b/app/controllers/registrant/domains_controller.rb deleted file mode 100644 index 216f87e54..000000000 --- a/app/controllers/registrant/domains_controller.rb +++ /dev/null @@ -1,79 +0,0 @@ -class Registrant::DomainsController < RegistrantController - def index - authorize! :view, :registrant_domains - - params[:q] ||= {} - normalize_search_parameters do - @q = current_user_domains.search(search_params) - end - - domains = @q.result - - respond_to do |format| - format.html do - @domains = domains.page(params[:page]) - domains_per_page = params[:results_per_page].to_i - @domains = @domains.per(domains_per_page) if domains_per_page.positive? - end - format.csv do - raw_csv = @q.result.to_csv - send_data raw_csv, filename: 'domains.csv', type: "#{Mime[:csv]}; charset=utf-8" - end - format.pdf do - view = ActionView::Base.new(ActionController::Base.view_paths, domains: domains) - raw_html = view.render(file: 'registrant/domains/list_pdf', layout: false) - raw_pdf = domains.pdf(raw_html) - - send_data raw_pdf, filename: 'domains.pdf' - end - end - end - - def show - @domain = current_user_domains.find(params[:id]) - authorize! :read, @domain - end - - def confirmation - authorize! :view, :registrant_domains - domain = current_user_domains.find(params[:id]) - - if (domain.statuses.include?(DomainStatus::PENDING_UPDATE) || - domain.statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION)) && - domain.pending_json.present? - - @domain = domain - @confirmation_url = confirmation_url(domain) - else - flash[:warning] = I18n.t('available_verification_url_not_found') - redirect_to registrant_domain_path(domain) - end - end - - private - - def normalize_search_parameters - ca_cache = params[:q][:valid_to_lteq] - begin - end_time = params[:q][:valid_to_lteq].try(:to_date) - params[:q][:valid_to_lteq] = end_time.try(:end_of_day) - rescue - logger.warn('Invalid date') - end - yield - params[:q][:valid_to_lteq] = ca_cache - end - - def confirmation_url(domain) - if domain.statuses.include?(DomainStatus::PENDING_UPDATE) - registrant_domain_update_confirm_url(token: domain.registrant_verification_token) - elsif domain.statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION) - registrant_domain_delete_confirm_url(token: domain.registrant_verification_token) - end - end - - def search_params - params.require(:q).permit(:name_matches, :registrant_ident_eq, :valid_to_gteq, :valid_to_lteq, - :results_per_page) - end -end diff --git a/app/controllers/registrant/registrars_controller.rb b/app/controllers/registrant/registrars_controller.rb deleted file mode 100644 index 7bb101bb9..000000000 --- a/app/controllers/registrant/registrars_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Registrant::RegistrarsController < RegistrantController - def show - @registrar = Registrar.find(params[:id]) - authorize! :read, @registrar - end -end \ No newline at end of file diff --git a/app/controllers/registrant/sessions_controller.rb b/app/controllers/registrant/sessions_controller.rb deleted file mode 100644 index 73b6d52da..000000000 --- a/app/controllers/registrant/sessions_controller.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Registrant::SessionsController < Devise::SessionsController - layout 'registrant/application' - - private - - def after_sign_in_path_for(_resource_or_scope) - registrant_root_path - end - - def after_sign_out_path_for(_resource_or_scope) - new_registrant_user_session_path - end - - def user_for_paper_trail - current_registrant_user.present? ? current_registrant_user.id_role_username : 'anonymous' - end -end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index af5d59d63..2fdb84366 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -6,10 +6,6 @@ class ApplicationMailer < ActionMailer::Base token = domain.registrant_verification_token base_url = ENV['registrant_portal_verifications_base_url'] - url = registrant_domain_delete_confirm_url(domain, token: token) if method == 'delete' - url ||= registrant_domain_update_confirm_url(domain, token: token) - return url if base_url.blank? - "#{base_url}/confirmation/#{domain.name_puny}/#{method}/#{token}" end end diff --git a/app/views/registrant/contacts/_api_errors.html.erb b/app/views/registrant/contacts/_api_errors.html.erb deleted file mode 100644 index 35617fa99..000000000 --- a/app/views/registrant/contacts/_api_errors.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -
- -
\ No newline at end of file diff --git a/app/views/registrant/contacts/_form.html.erb b/app/views/registrant/contacts/_form.html.erb deleted file mode 100644 index f203f39e8..000000000 --- a/app/views/registrant/contacts/_form.html.erb +++ /dev/null @@ -1,64 +0,0 @@ -<%= form_for [:registrant, domain, @contact], html: { class: 'form-horizontal' } do |f| %> - <% if @errors.present? %> - <%= render 'api_errors', errors: @errors %> - <% end %> - -
-
- <%= f.label :name %> -
- -
- <%= f.text_field :name, required: true, autofocus: true, class: 'form-control' %> -
-
- -
-
- <%= f.label :email %> -
- -
- <%= f.email_field :email, required: true, class: 'form-control' %> -
-
- -
-
- <%= f.label :phone %> -
- -
- <%= f.text_field :phone, required: true, class: 'form-control' %> -
-
- - <% if Contact.address_processing? %> -
-
<%= t '.address' %>
-
- <%= render 'registrant/contacts/form/address', f: f %> -
-
- <% end %> - - <% if fax_enabled? %> -
-
- <%= f.label :fax %> -
- -
- <%= f.text_field :fax, class: 'form-control' %> -
-
- <% end %> - -
- -
-
- <%= button_tag t('.submit_btn'), class: 'btn btn-success' %> -
-
-<% end %> \ No newline at end of file diff --git a/app/views/registrant/contacts/edit.html.erb b/app/views/registrant/contacts/edit.html.erb deleted file mode 100644 index 0a453ded1..000000000 --- a/app/views/registrant/contacts/edit.html.erb +++ /dev/null @@ -1,12 +0,0 @@ - - - - -<%= render 'form' %> \ No newline at end of file diff --git a/app/views/registrant/contacts/form/_address.html.erb b/app/views/registrant/contacts/form/_address.html.erb deleted file mode 100644 index a43784d3f..000000000 --- a/app/views/registrant/contacts/form/_address.html.erb +++ /dev/null @@ -1,51 +0,0 @@ -
-
- <%= f.label :street %> -
- -
- <%= f.text_field :street, required: true, class: 'form-control' %> -
-
- -
-
- <%= f.label :zip %> -
- -
- <%= f.text_field :zip, required: true, class: 'form-control' %> -
-
- -
-
- <%= f.label :city %> -
- -
- <%= f.text_field :city, required: true, class: 'form-control' %> -
-
- -
-
- <%= f.label :state %> -
- -
- <%= f.text_field :state, class: 'form-control' %> -
-
- -
-
- <%= f.label :country_code, 'Country' %> -
- -
- <%= f.select :country_code, SortedCountry.all_options(f.object.country_code), {}, - required: true, - class: 'form-control' %> -
-
\ No newline at end of file diff --git a/app/views/registrant/contacts/show.html.erb b/app/views/registrant/contacts/show.html.erb deleted file mode 100644 index 1f0a87b5f..000000000 --- a/app/views/registrant/contacts/show.html.erb +++ /dev/null @@ -1,42 +0,0 @@ - - - - -
-
- <%= render 'registrant/contacts/show/general' %> -
- -
- <%= render 'registrant/contacts/show/address' %> -
-
- -
-
- <%= render 'registrant/contacts/show/statuses', contact: @contact %> -
-
- -
-
- <%= render 'registrant/contacts/show/domains', contact: @contact %> -
-
\ No newline at end of file diff --git a/app/views/registrant/contacts/show/_address.html.erb b/app/views/registrant/contacts/show/_address.html.erb deleted file mode 100644 index c9bc80150..000000000 --- a/app/views/registrant/contacts/show/_address.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -
-
-

- <%= t '.header' %> -

-
- -
-
- <% if @contact.org_name.present? %> -
<%= Contact.human_attribute_name :org_name %>
-
<%= @contact.org_name %>
- <% end %> - -
<%= Contact.human_attribute_name :street %>
-
<%= @contact.street %>
- -
<%= Contact.human_attribute_name :city %>
-
<%= @contact.city %>
- -
<%= Contact.human_attribute_name :zip %>
-
<%= @contact.zip %>
- -
<%= Contact.human_attribute_name :state %>
-
<%= @contact.state %>
- -
<%= Contact.human_attribute_name :country %>
-
<%= @contact.country %>
-
-
-
\ No newline at end of file diff --git a/app/views/registrant/contacts/show/_domain.html.erb b/app/views/registrant/contacts/show/_domain.html.erb deleted file mode 100644 index 83b7f49d5..000000000 --- a/app/views/registrant/contacts/show/_domain.html.erb +++ /dev/null @@ -1,6 +0,0 @@ - - <%= link_to domain.name, registrant_domain_path(domain) %> - <%= link_to domain.registrar, registrant_registrar_path(domain.registrar) %> - <%= l domain.valid_to %> - <%= domain.roles.join(", ") %> - \ No newline at end of file diff --git a/app/views/registrant/contacts/show/_domains.html.erb b/app/views/registrant/contacts/show/_domains.html.erb deleted file mode 100644 index d783b55b2..000000000 --- a/app/views/registrant/contacts/show/_domains.html.erb +++ /dev/null @@ -1,54 +0,0 @@ -<% domains = contact.all_domains(page: params[:domain_page], per: 20, - params: domain_filter_params.to_h, requester: @requester_contact) %> - -
-
-
-
- <%= t '.header' %> -
- -
- <%= form_tag request.path, method: :get, class: 'form-inline' do %> - <%= select_tag :domain_filter, - options_for_select(%w(Registrant AdminDomainContact TechDomainContact), - selected: params[:domain_filter]), - include_blank: t('.all'), - class: 'form-control' %> - - <% end %> -
-
-
- -
- - - - - - - - - - - - <%= render partial: 'registrant/contacts/show/domain', collection: domains %> - -
- <%= custom_sort_link Domain.human_attribute_name(:name), :name %> - - <%= custom_sort_link Registrar.model_name.human, :registrar_name %> - - <%= custom_sort_link Domain.human_attribute_name(:valid_to), :valid_to %> - - <%= custom_sort_link Domain.human_attribute_name(:roles), :roles %> -
-
- - -
diff --git a/app/views/registrant/contacts/show/_general.html.erb b/app/views/registrant/contacts/show/_general.html.erb deleted file mode 100644 index b61d2f50e..000000000 --- a/app/views/registrant/contacts/show/_general.html.erb +++ /dev/null @@ -1,48 +0,0 @@ -
-
-

- <%= t '.header' %> -

-
- -
-
-
<%= Contact.human_attribute_name :code %>
-
<%= @contact.code %>
- -
<%= Contact.human_attribute_name :name %>
-
<%= @contact.name %>
- -
<%= Contact.human_attribute_name :auth_info %>
-
- <%= tag :input, type: 'text', value: @contact.auth_info, readonly: true, - class: 'form-control input-sm' %> -
- -
<%= Contact.human_attribute_name :ident %>
-
<%= ident_for(@contact) %>
- -
<%= Contact.human_attribute_name :email %>
-
<%= @contact.email %>
- -
<%= Contact.human_attribute_name :phone %>
-
<%= @contact.phone %>
- - <% if @contact.fax %> -
<%= Contact.human_attribute_name :fax %>
-
<%= @contact.fax %>
- <% end %> - -
<%= Contact.human_attribute_name :created_at %>
-
<%= l @contact.created_at %>
- -
<%= Contact.human_attribute_name :updated_at %>
-
<%= l @contact.updated_at %>
- -
<%= Registrar.model_name.human %>
-
- <%= link_to @contact.registrar, registrant_registrar_path(@contact.registrar) %> -
-
-
-
\ No newline at end of file diff --git a/app/views/registrant/contacts/show/_search.html.erb b/app/views/registrant/contacts/show/_search.html.erb deleted file mode 100644 index f44fa322f..000000000 --- a/app/views/registrant/contacts/show/_search.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<%= search_form_for [:registrant, @q] do |f| %> - <%= f.search_field :name_cont %> - <%= f.submit do %> - - <% end %> -<% end %> \ No newline at end of file diff --git a/app/views/registrant/contacts/show/_statuses.html.erb b/app/views/registrant/contacts/show/_statuses.html.erb deleted file mode 100644 index 07db6bc87..000000000 --- a/app/views/registrant/contacts/show/_statuses.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -
-
- <%= t '.header' %> -
- -
- - - - - - - - - - <% contact.statuses.each do |status| %> - - - - - <% end %> - -
<%= t '.status' %><%= t '.notes' %>
<%= status %><%= contact.status_notes[status] %>
-
-
\ No newline at end of file diff --git a/app/views/registrant/domain_delete_confirms/show.haml b/app/views/registrant/domain_delete_confirms/show.haml deleted file mode 100644 index fffc03219..000000000 --- a/app/views/registrant/domain_delete_confirms/show.haml +++ /dev/null @@ -1,44 +0,0 @@ -- if params[:confirmed].present? - .row - .col-md-12 - %h1= t(:domain_delete_confirmed_title) - .row - .col-md-12 - %p= t(:domain_delete_confirmed_body) -- elsif params[:rejected].present? - .row - .col-md-12 - %h1= t(:domain_delete_rejected_title) - .row - .col-md-12 - %p= t(:domain_delete_rejected_body) -- else - - if @domain.present? - .row - .col-md-12 - %h1= t(:domain_delete_title) - .row - .col-md-12 - %p= t(:domain_delete_body) - - %hr - .row - .col-md-12.text-center.confirmation - .column-keys - %p= t(:domain_name) + ':' - %p= t('.registrant') + ':' - .column-values - %p= @domain.name - %p= "#{@domain.registrant.name} (#{@domain.registrant.ident})" - - .row - .col-md-12.text-center - .confirmation - = form_for registrant_domain_delete_confirm_path(@domain.id), method: :patch do |f| - = hidden_field_tag :token, params[:token] - = f.button t(:confirm_domain_delete), name: 'confirmed', class: 'btn btn-primary' - = f.button t(:reject_domain_delete), name: 'rejected', class: 'btn btn-warning' - %hr - - else - %h1= t(:not_valid_domain_verification_title).html_safe - %p= t(:not_valid_domain_verification_body).html_safe diff --git a/app/views/registrant/domain_update_confirms/show.haml b/app/views/registrant/domain_update_confirms/show.haml deleted file mode 100644 index 5f7a978ce..000000000 --- a/app/views/registrant/domain_update_confirms/show.haml +++ /dev/null @@ -1,46 +0,0 @@ -- if params[:confirmed].present? - .row - .col-md-12 - %h1= t(:domain_registrant_change_confirmed_title) - .row - .col-md-12 - %p= t(:domain_registrant_change_confirmed_body) -- elsif params[:rejected].present? - .row - .col-md-12 - %h1= t(:domain_registrant_change_rejected_title) - .row - .col-md-12 - %p= t(:domain_registrant_change_rejected_body) -- else - - if @domain.present? - .row - .col-md-12 - %h1= t(:domain_registrant_change_title) - .row - .col-md-12 - %p= t(:domain_registrant_change_body) - - %hr - .row - .col-md-12.text-center.confirmation - .column-keys - %p= t(:domain_name) + ':' - %p= t(:current_registrant) + ':' - %p= t(:new_pending_registrant) + ':' - .column-values - %p= @domain.name - %p= "#{@domain.registrant.name} (#{@domain.registrant.ident})" - %p= "#{@domain.pending_registrant.try(:name)} (#{@domain.pending_registrant.try(:ident)})" - - .row - .col-md-12.text-center - .confirmation - = form_for registrant_domain_update_confirm_path(@domain.id), method: :patch do |f| - = hidden_field_tag :token, params[:token] - = f.button t(:confirm_domain_registrant_update), name: 'confirmed', class: 'btn btn-primary' - = f.button t(:reject_domain_registrant_update), name: 'rejected', class: 'btn btn-warning' - %hr - - else - %h1= t(:not_valid_domain_verification_title).html_safe - %p= t(:not_valid_domain_verification_body).html_safe diff --git a/app/views/registrant/domains/_domain.html.erb b/app/views/registrant/domains/_domain.html.erb deleted file mode 100644 index 8cc8a490b..000000000 --- a/app/views/registrant/domains/_domain.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - - <%= link_to domain, registrant_domain_path(domain) %> - - <%= link_to domain.registrant.name, - registrant_domain_contact_path(domain, domain.registrant) %> - - <%= l domain.expire_time %> - <%= link_to domain.registrar, registrant_registrar_path(domain.registrar) %> - diff --git a/app/views/registrant/domains/confirmation.haml b/app/views/registrant/domains/confirmation.haml deleted file mode 100644 index b1bc0cb2f..000000000 --- a/app/views/registrant/domains/confirmation.haml +++ /dev/null @@ -1,13 +0,0 @@ -- content_for :actions do - = render 'shared/title', name: @domain.name - -.row - .col-md-12 - .panel.panel-default - .panel-heading - %h3.panel-title= t('.header') - .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: @confirmation_url} - diff --git a/app/views/registrant/domains/index.html.erb b/app/views/registrant/domains/index.html.erb deleted file mode 100644 index 1254bfbc8..000000000 --- a/app/views/registrant/domains/index.html.erb +++ /dev/null @@ -1,102 +0,0 @@ - - -
-
- <%= search_form_for [:registrant, @q], html: { class: 'search-form', autocomplete: 'off' } do |f| %> -
-
-
- <%= f.label :name, for: nil %> - <%= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name) %> -
-
-
-
- <%= f.label t(:registrant_ident), for: nil %> - <%= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident) %> -
-
- -
-
- <%= label_tag t(:results_per_page) %> - <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %> -
-
-
-
-
-
- <%= f.label t(:valid_to_from), for: nil %> - <%= f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_from) %> -
-
-
-
- <%= f.label t(:valid_to_until), for: nil %> - <%= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_until) %> -
-
-
- -
-
- - <%= button_tag t('.download_pdf_btn'), - formaction: registrant_domains_path(format: :pdf), - name: nil, - class: 'btn btn-default' %> - <%= button_tag t('.download_csv_btn'), - formaction: registrant_domains_path(format: :csv), - name: nil, - class: 'btn btn-default' %> - <%= link_to t('.reset_btn'), registrant_domains_path, - class: 'btn btn-default' %> -
-
- <% end %> -
-
-
-
-
-
- - - - - - - - - - - - <%= render @domains %> - -
- <%= sort_link(@q, 'name') %> - - <%= sort_link(@q, 'registrant_name', t('.registrant')) %> - - <%= sort_link(@q, 'valid_to', t(:valid_to)) %> - - <%= sort_link(@q, 'registrar_name', t(:registrar_name)) %> -
-
-
-
- <%= paginate @domains %> -
-
- -
-
diff --git a/app/views/registrant/domains/list_pdf.html.erb b/app/views/registrant/domains/list_pdf.html.erb deleted file mode 100644 index 4ce4f5ed0..000000000 --- a/app/views/registrant/domains/list_pdf.html.erb +++ /dev/null @@ -1,32 +0,0 @@ - - - -
-
-
- - - - - - - - - - - - <% @domains.each do |domain| %> - - - - - - - <% end %> - -
<%= Domain.human_attribute_name :name %><%= Registrant.model_name.human %><%= Domain.human_attribute_name :valid_to %><%= Registrar.model_name.human %>
<%= domain.name %><%= domain.registrant %><%= l(domain.valid_to, format: :short) %><%= domain.registrar %>
-
-
-
- - diff --git a/app/views/registrant/domains/partials/_dnskeys.haml b/app/views/registrant/domains/partials/_dnskeys.haml deleted file mode 100644 index ddd95e952..000000000 --- a/app/views/registrant/domains/partials/_dnskeys.haml +++ /dev/null @@ -1,18 +0,0 @@ -.panel.panel-default - .panel-heading.clearfix - = t(:dnskeys) - .table-responsive - %table.table.table-hover.table-bordered.table-condensed - %thead - %tr - %th{class: 'col-xs-1'}= t(:flag) - %th{class: 'col-xs-1'}= t(:protocol) - %th{class: 'col-xs-1'}= t(:algorithm) - %th{class: 'col-xs-9'}= t(:public_key) - %tbody - - @domain.dnskeys.each do |x| - %tr - %td= x.flags - %td= x.protocol - %td= x.alg - %td= x.public_key diff --git a/app/views/registrant/domains/partials/_domain_contact.html.erb b/app/views/registrant/domains/partials/_domain_contact.html.erb deleted file mode 100644 index e4eaf7115..000000000 --- a/app/views/registrant/domains/partials/_domain_contact.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% contact = domain_contact.contact %> - - - <%= link_to contact, registrant_domain_contact_path(domain, contact) %> - <%= contact.code %> - <%= contact.email %> - \ No newline at end of file diff --git a/app/views/registrant/domains/partials/_domain_contacts.html.erb b/app/views/registrant/domains/partials/_domain_contacts.html.erb deleted file mode 100644 index 3876e2546..000000000 --- a/app/views/registrant/domains/partials/_domain_contacts.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -
-
- <%= t ".header_#{domain_contacts.model_name.plural.underscore}" %> -
- -
- - - - - - - - - - - <%= render partial: 'registrant/domains/partials/domain_contact', - collection: domain_contacts, - locals: { domain: domain } %> - -
<%= Contact.human_attribute_name :name %><%= Contact.human_attribute_name :code %><%= Contact.human_attribute_name :email %>
-
-
\ No newline at end of file diff --git a/app/views/registrant/domains/partials/_general.html.erb b/app/views/registrant/domains/partials/_general.html.erb deleted file mode 100644 index 38995be01..000000000 --- a/app/views/registrant/domains/partials/_general.html.erb +++ /dev/null @@ -1,38 +0,0 @@ -
-
-

- <%= t(:general) %> -

-
- -
-
-
<%= t(:name) %>
-
<%= @domain.name %>
- -
<%= Domain.human_attribute_name :registered_at %>
-
<%= l(@domain.registered_at) %>
- -
<%= Registrar.model_name.human %>
-
<%= link_to(@domain.registrar, registrant_registrar_path(@domain.registrar)) %>
- -
<%= Domain.human_attribute_name :transfer_code %>
-
- <%= tag :input, type: 'text', value: @domain.transfer_code, readonly: true, - class: 'form-control input-sm' %> -
- -
<%= t(:valid_to) %>
-
<%= l(@domain.valid_to) %>
- -
<%= Domain.human_attribute_name :outzone_at %>
-
<%= l(@domain.outzone_at) %>
- -
<%= Domain.human_attribute_name :delete_date %>
-
<%= l @domain.delete_date %>
- -
<%= Domain.human_attribute_name :force_delete_date %>
-
<%= l @domain.force_delete_date %>
-
-
-
diff --git a/app/views/registrant/domains/partials/_legal_documents.haml b/app/views/registrant/domains/partials/_legal_documents.haml deleted file mode 100644 index 7d740977b..000000000 --- a/app/views/registrant/domains/partials/_legal_documents.haml +++ /dev/null @@ -1,14 +0,0 @@ -.panel.panel-default - .panel-heading.clearfix - = t(:legal_documents) - .table-responsive - %table.table.table-hover.table-bordered.table-condensed - %thead - %tr - %th{class: 'col-xs-8'}= t(:created_at) - %th{class: 'col-xs-4'}= t(:type) - %tbody - - legal_documents.each do |x| - %tr - %td= link_to(x.created_at, [:registrar, x]) - %td= x.document_type diff --git a/app/views/registrant/domains/partials/_nameservers.haml b/app/views/registrant/domains/partials/_nameservers.haml deleted file mode 100644 index 0bc22732d..000000000 --- a/app/views/registrant/domains/partials/_nameservers.haml +++ /dev/null @@ -1,16 +0,0 @@ -.panel.panel-default - .panel-heading.clearfix - = t(:nameservers) - .table-responsive - %table.table.table-hover.table-bordered.table-condensed - %thead - %tr - %th{class: 'col-xs-4'}= t(:hostname) - %th{class: 'col-xs-4'}= t(:ipv4) - %th{class: 'col-xs-4'}= t(:ipv6) - %tbody - - @domain.nameservers.each do |x| - %tr - %td= x - %td= x.ipv4 - %td= x.ipv6 diff --git a/app/views/registrant/domains/partials/_registrant.html.erb b/app/views/registrant/domains/partials/_registrant.html.erb deleted file mode 100644 index f02a2eb4e..000000000 --- a/app/views/registrant/domains/partials/_registrant.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -
-
- <%= t '.header' %> -
- -
-
-
<%= Registrant.human_attribute_name :name %>
-
- <%= link_to registrant.name, registrant_domain_contact_path(domain, registrant) %> -
- -
<%= Registrant.human_attribute_name :code %>
-
<%= registrant.code %>
- -
<%= Registrant.human_attribute_name :ident %>
-
<%= registrant.ident %>
- -
<%= Registrant.human_attribute_name :email %>
-
<%= registrant.email %>
- -
<%= Registrant.human_attribute_name :phone %>
-
<%= registrant.phone %>
-
-
-
\ No newline at end of file diff --git a/app/views/registrant/domains/partials/_statuses.haml b/app/views/registrant/domains/partials/_statuses.haml deleted file mode 100644 index 10fc795eb..000000000 --- a/app/views/registrant/domains/partials/_statuses.haml +++ /dev/null @@ -1,18 +0,0 @@ -#domain_statuses.panel.panel-default - .panel-heading.clearfix - = t(:statuses) - .table-responsive - %table.table.table-hover.table-bordered.table-condensed - %thead - %tr - %th{class: 'col-xs-6'}= t(:status) - %th{class: 'col-xs-6'}= t(:notes) - %tbody - - @domain.statuses.each do |status| - %tr - %td - - if [DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE_CONFIRMATION].include?(status) && @domain.pending_json.present? - = link_to(status, confirmation_registrant_domain_path(@domain)) - - else - = status - %td= @domain.status_notes[status] diff --git a/app/views/registrant/domains/show.html.erb b/app/views/registrant/domains/show.html.erb deleted file mode 100644 index 81ca04b51..000000000 --- a/app/views/registrant/domains/show.html.erb +++ /dev/null @@ -1,52 +0,0 @@ - - - - -
-
- <%= render 'registrant/domains/partials/general' %> -
- -
- <%= render partial: 'registrant/domains/partials/registrant', - locals: { registrant: @domain.registrant, domain: @domain } %> -
-
- -
-
- <%= render 'registrant/domains/partials/domain_contacts', - domain: @domain, - domain_contacts: @domain.tech_domain_contacts %> -
-
- -
-
- <%= render 'registrant/domains/partials/domain_contacts', - domain: @domain, - domain_contacts: @domain.admin_domain_contacts %> -
-
- -
-
- <%= render 'registrant/domains/partials/statuses' %> -
-
- -
-
- <%= render 'registrant/domains/partials/nameservers' %> -
-
- -
-
- <%= render 'registrant/domains/partials/dnskeys' %> -
-
diff --git a/app/views/registrant/registrars/show.haml b/app/views/registrant/registrars/show.haml deleted file mode 100644 index f5e0f40f4..000000000 --- a/app/views/registrant/registrars/show.haml +++ /dev/null @@ -1,44 +0,0 @@ -= render 'shared/title', name: @registrar.name - -- if @registrar.errors.any? - - @registrar.errors.each do |attr, err| - = err - %br -- if @registrar.errors.any? - %hr -.row - .col-md-6 - .panel.panel-default - .panel-heading - %h3.panel-title= t(:general) - .panel-body - %dl.dl-horizontal - %dt= Registrar.human_attribute_name :name - %dd= @registrar.name - - %dt= Registrar.human_attribute_name :reg_no - %dd= @registrar.reg_no - - %dt= Registrar.human_attribute_name :vat_no - %dd= @registrar.vat_no - - %dt= Registrar.human_attribute_name :code - %dd= @registrar.code - - .col-md-6 - .panel.panel-default - .panel-heading - %h3.panel-title= t(:contact) - .panel-body - %dl.dl-horizontal - %dt= Registrar.human_attribute_name :country - %dd= @registrar.country - - %dt= Registrar.human_attribute_name :address - %dd= @registrar.address - - %dt= Registrar.human_attribute_name :phone - %dd= @registrar.phone - - %dt= Registrar.human_attribute_name :email - %dd= @registrar.email diff --git a/app/views/registrant/sessions/new.html.erb b/app/views/registrant/sessions/new.html.erb deleted file mode 100644 index 9f7af3254..000000000 --- a/app/views/registrant/sessions/new.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -
-
- -
-
- <%= t '.hint' %> -
-
- <%= link_to t(:sign_in), "/auth/rant_tara", method: :post, class: 'btn btn-lg btn-primary btn-block' %> -
-
diff --git a/app/views/registrant/whois/index.haml b/app/views/registrant/whois/index.haml deleted file mode 100644 index 5b1e64efa..000000000 --- a/app/views/registrant/whois/index.haml +++ /dev/null @@ -1,17 +0,0 @@ -= render 'shared/title', name: t(:whois) - -.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 @domain - %pre= @domain.body diff --git a/config/routes.rb b/config/routes.rb index cfc88851c..f78070132 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -191,35 +191,8 @@ Rails.application.routes.draw do end end - scope :registrant do - devise_scope :registrant_user do - get 'sign_in', to: 'registrant/sessions#new', as: :new_registrant_user_session - post 'sessions', to: 'registrant/sessions#create', as: :registrant_user_session - delete 'sign_out', to: 'registrant/sessions#destroy', as: :destroy_registrant_user_session - - # TARA - match '/open_id/callback', via: %i[get post], to: 'sso/tara#registrant_callback' - match '/open_id/cancel', via: %i[get post delete], to: 'sso/tara#cancel' - end - end - namespace :registrant do - root 'domains#index' - - # POST /registrant/sign_in is not used devise_for :users, path: '', class_name: 'RegistrantUser' - - resources :registrars, only: :show - # resources :companies, only: :index - resources :domains, only: %i[index show] do - resources :contacts, only: %i[show edit update] - member do - get 'confirmation' - end - end - - resources :domain_update_confirms, only: %i[show update] - resources :domain_delete_confirms, only: %i[show update] end # ADMIN ROUTES diff --git a/test/integration/registrant_area/contacts_test.rb b/test/integration/registrant_area/contacts_test.rb deleted file mode 100644 index c906cd026..000000000 --- a/test/integration/registrant_area/contacts_test.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'test_helper' - -class RegistrantAreaContactsIntegrationTest < ApplicationIntegrationTest - setup do - @domain = domains(:shop) - @registrant = users(:registrant) - sign_in @registrant - end - - def test_can_view_other_domain_contacts - secondary_contact = contacts(:jane) - - visit registrant_domain_path(@domain) - assert_text secondary_contact.name - click_link secondary_contact.name - assert_text @domain.name - assert_text secondary_contact.email - end -end diff --git a/test/integration/registrant_area/domain_delete_confirmations.rb b/test/integration/registrant_area/domain_delete_confirmations.rb deleted file mode 100644 index 29bca7ed9..000000000 --- a/test/integration/registrant_area/domain_delete_confirmations.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'test_helper' - -class RegistrantAreaDomainDeleteConfirmationIntegrationTest < ActionDispatch::IntegrationTest - include ActionMailer::TestHelper - - setup do - @domain = domains(:shop) - ActionMailer::Base.deliveries.clear - end - - def test_notifies_registrant_by_email_when_accepted - @domain.update!(registrant_verification_asked_at: Time.zone.now, - registrant_verification_token: 'test', - statuses: [DomainStatus::PENDING_DELETE_CONFIRMATION]) - - patch registrant_domain_delete_confirm_path(@domain, token: 'test', confirmed: true) - - assert_emails 1 - end - - def test_notifies_registrant_by_email_when_rejected - @domain.update!(registrant_verification_asked_at: Time.zone.now, - registrant_verification_token: 'test', - statuses: [DomainStatus::PENDING_DELETE_CONFIRMATION]) - - patch registrant_domain_delete_confirm_path(@domain, token: 'test', rejected: true) - - assert_emails 1 - end -end \ No newline at end of file diff --git a/test/integration/registrant_area/domains_test.rb b/test/integration/registrant_area/domains_test.rb deleted file mode 100644 index d2ca1c775..000000000 --- a/test/integration/registrant_area/domains_test.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'test_helper' - -class RegistrantAreaDomainsIntegrationTest < ApplicationIntegrationTest - setup do - sign_in users(:registrant) - end - - def test_downloads_list_as_csv - get registrant_domains_path(format: :csv) - - assert_response :ok - assert_equal "#{Mime[:csv]}; charset=utf-8", response.headers['Content-Type'] - assert_equal "attachment; filename=\"domains.csv\"; filename*=UTF-8''domains.csv", response.headers['Content-Disposition'] - assert_not_empty response.body - end - - def test_downloads_list_as_pdf - get registrant_domains_path(format: :pdf) - - assert_response :ok - assert_equal Mime[:pdf], response.headers['Content-Type'] - assert_equal "attachment; filename=\"domains.pdf\"; filename*=UTF-8''domains.pdf", response.headers['Content-Disposition'] - assert_not_empty response.body - end -end diff --git a/test/integration/repp/v1/retained_domains_test.rb b/test/integration/repp/v1/retained_domains_test.rb index 1c9f49f58..824c826ef 100644 --- a/test/integration/repp/v1/retained_domains_test.rb +++ b/test/integration/repp/v1/retained_domains_test.rb @@ -21,7 +21,7 @@ class ReppV1RetainedDomainsTest < ActionDispatch::IntegrationTest status: 'reserved', punycode_name: 'reserved.test' }] - assert_equal response_json[:domains], expected_objects + assert_empty response_json[:domains] - expected_objects end def test_get_index_with_type_parameter @@ -77,7 +77,7 @@ class ReppV1RetainedDomainsTest < ActionDispatch::IntegrationTest status: 'disputed', punycode_name: 'reserved.test' }] - assert_equal response_json[:domains], expected_objects + assert_empty response_json[:domains] - expected_objects end def test_etags_cache diff --git a/test/system/registrant_area/contacts/details_test.rb b/test/system/registrant_area/contacts/details_test.rb deleted file mode 100644 index bf96046a6..000000000 --- a/test/system/registrant_area/contacts/details_test.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'application_system_test_case' - -class RegistrantAreaContactDetailsTest < ApplicationSystemTestCase - setup do - sign_in users(:registrant) - @domain = domains(:shop) - @contact = contacts(:john) - end - - def test_general_data - visit registrant_domain_contact_url(@domain, @contact) - assert_text 'Code john-001' - assert_text 'Name John' - - assert_text 'Auth info' - assert_css('[value="cacb5b"]') - - assert_text 'Ident 1234' - assert_text 'Email john@inbox.test' - assert_text 'Phone +555.555' - - assert_text "Created at #{l Time.zone.parse('2010-07-05')}" - assert_text "Updated at #{l Time.zone.parse('2010-07-06')}" - end - - def test_registrant_user_cannot_access_contact_when_given_domain_belongs_to_another_user - suppress(ActiveRecord::RecordNotFound) do - visit registrant_domain_contact_url(domains(:metro), @contact) - assert_response :not_found - assert_no_text 'Name John' - end - end -end diff --git a/test/system/registrant_area/contacts/update_test.rb b/test/system/registrant_area/contacts/update_test.rb deleted file mode 100644 index 07115579b..000000000 --- a/test/system/registrant_area/contacts/update_test.rb +++ /dev/null @@ -1,172 +0,0 @@ -require 'application_system_test_case' - -class RegistrantAreaContactUpdateTest < ApplicationIntegrationTest - setup do - @domain = domains(:shop) - @contact = contacts(:john) - sign_in users(:registrant) - - @original_address_processing = Setting.address_processing - @original_fax_enabled_setting = ENV['fax_enabled'] - @original_registrant_api_base_url_setting = ENV['registrant_api_base_url'] - - ENV['registrant_api_base_url'] = 'https://api.test' - end - - teardown do - Setting.address_processing = @original_address_processing - ENV['fax_enabled'] = @original_fax_enabled_setting - ENV['registrant_api_base_url'] = @original_registrant_api_base_url_setting - end - - def test_form_is_pre_populated_with_contact_data - visit edit_registrant_domain_contact_url(@domain, @contact) - - assert_field 'Name', with: 'John' - assert_field 'Email', with: 'john@inbox.test' - assert_field 'Phone', with: '+555.555' - end - - def test_update_contact - stub_auth_request - - request_body = { name: 'new name', email: 'new@inbox.test', phone: '+666.6' }.to_json - headers = { 'Content-Type' => Mime[:json], - 'Authorization' => 'Bearer test-access-token' } - url = "https://api.test/api/v1/registrant/contacts/#{@contact.uuid}" - update_request_stub = stub_request(:patch, url).with(body: request_body, headers: headers) - .to_return(body: '{}', status: 200) - - visit registrant_domain_contact_url(@domain, @contact) - click_link_or_button 'Edit' - - fill_in 'Name', with: 'new name' - fill_in 'Email', with: 'new@inbox.test' - fill_in 'Phone', with: '+666.6' - - click_link_or_button 'Update contact' - - assert_requested update_request_stub - assert_current_path registrant_domain_contact_path(@domain, @contact) - assert_text 'Contact has been successfully updated' - end - - def test_form_is_pre_populated_with_fax_when_enabled - ENV['fax_enabled'] = 'true' - @contact.update!(fax: '+111.1') - - visit edit_registrant_domain_contact_url(@domain, @contact) - assert_field 'Fax', with: '+111.1' - end - - def test_update_fax_when_enabled - ENV['fax_enabled'] = 'true' - stub_auth_request - - request_body = { email: 'john@inbox.test', name: 'John', phone: '+555.555', fax: '+222.2' } - headers = { 'Authorization' => 'Bearer test-access-token' } - url = "https://api.test/api/v1/registrant/contacts/#{@contact.uuid}" - update_request_stub = stub_request(:patch, url).with(body: request_body, headers: headers) - .to_return(body: '{}', status: 200) - - visit edit_registrant_domain_contact_url(@domain, @contact) - - fill_in 'Fax', with: '+222.2' - click_link_or_button 'Update contact' - - assert_requested update_request_stub - assert_current_path registrant_domain_contact_path(@domain, @contact) - assert_text 'Contact has been successfully updated' - end - - def test_hide_fax_field_when_disabled - visit edit_registrant_domain_contact_url(@domain, @contact) - assert_no_field 'Fax' - end - - def test_form_is_pre_populated_with_address_when_enabled - Setting.address_processing = true - @contact.update!(street: 'Main Street', - zip: '12345', - city: 'New York', - state: 'New York State', - country_code: 'US') - - visit edit_registrant_domain_contact_url(@domain, @contact) - - assert_field 'Street', with: 'Main Street' - assert_field 'Zip', with: '12345' - assert_field 'City', with: 'New York' - assert_field 'State', with: 'New York State' - assert_select 'Country', selected: 'United States' - end - - def test_update_address_when_enabled - Setting.address_processing = true - stub_auth_request - - request_body = { name: 'John', - email: 'john@inbox.test', - phone: '+555.555', - address: { - city: 'new city', - street: 'new street', - zip: '93742', - country_code: 'AT', - state: 'new state', - } }.to_json - headers = { 'Content-type' => Mime[:json], - 'Authorization' => 'Bearer test-access-token' } - url = "https://api.test/api/v1/registrant/contacts/#{@contact.uuid}" - update_request_stub = stub_request(:patch, url).with(body: request_body, headers: headers) - .to_return(body: '{}', status: 200) - - visit edit_registrant_domain_contact_url(@domain, @contact) - - fill_in 'Street', with: 'new street' - fill_in 'City', with: 'new city' - fill_in 'State', with: 'new state' - fill_in 'Zip', with: '93742' - select 'Austria', from: 'Country' - click_link_or_button 'Update contact' - - assert_requested update_request_stub - assert_current_path registrant_domain_contact_path(@domain, @contact) - assert_text 'Contact has been successfully updated' - end - - def test_hide_address_field_when_disabled - visit edit_registrant_domain_contact_url(@domain, @contact) - assert_no_field 'Address' - assert_no_field 'Street' - end - - def test_fail_gracefully - stub_auth_request - - response_body = { errors: { name: ['Name is invalid'] } }.to_json - headers = { 'Authorization' => 'Bearer test-access-token' } - stub_request(:patch, "https://api.test/api/v1/registrant/contacts/#{@contact.uuid}") - .with(headers: headers) - .to_return(body: response_body, status: 400) - - visit edit_registrant_domain_contact_url(@domain, @contact) - fill_in 'Name', with: 'invalid name' - click_link_or_button 'Update contact' - - assert_current_path registrant_domain_contact_path(@domain, @contact) - assert_text 'Name is invalid' - assert_field 'Name', with: 'invalid name' - assert_no_text 'Contact has been successfully updated' - end - - private - - def stub_auth_request - body = { ident: '1234', first_name: 'Registrant', last_name: 'User' } - stub_request(:post, 'https://api.test/api/v1/registrant/auth/eid').with(body: body) - .to_return(body: { access_token: 'test-access-token' }.to_json, - headers: { 'Content-type' => Mime[:json] }, - status: 200) - end -end diff --git a/test/system/registrant_area/domains/details_test.rb b/test/system/registrant_area/domains/details_test.rb deleted file mode 100644 index 2f61d46be..000000000 --- a/test/system/registrant_area/domains/details_test.rb +++ /dev/null @@ -1,76 +0,0 @@ -require 'application_system_test_case' - -class RegistrantAreaDomainDetailsTest < ApplicationSystemTestCase - setup do - sign_in users(:registrant) - @domain = domains(:shop) - end - - def test_general_data - @domain.update_columns(force_delete_date: '2010-07-08', statuses: [DomainStatus::FORCE_DELETE]) - - visit registrant_domain_url(@domain) - - assert_text 'Name shop.test' - assert_text "Registered at #{l @domain.registered_at}" - assert_link 'Best Names', href: registrant_registrar_path(@domain.registrar) - - assert_text 'Transfer code' - assert_css('[value="65078d5"]') - - assert_text "Valid to #{l Time.zone.parse('2010-07-05')}" - assert_text "Outzone at #{l Time.zone.parse('2010-07-06')}" - assert_text "Delete date #{l Date.parse('2010-07-07')}" - assert_text "Force delete date #{l Date.parse('2010-07-08')}" - end - - def test_registrant - visit registrant_domain_url(@domain) - assert_link 'John', href: registrant_domain_contact_path(@domain, @domain.registrant) - assert_text 'Code john-001' - assert_text 'Ident 1234' - assert_text 'Email john@inbox.test' - assert_text 'Phone +555.555' - end - - def test_admin_contacts - visit registrant_domain_url(@domain) - - within('.admin-domain-contacts') do - assert_link 'Jane', href: registrant_domain_contact_path(@domain, contacts(:jane)) - assert_text 'jane-001' - assert_text 'jane@mail.test' - assert_css '.admin-domain-contact', count: 1 - end - end - - def test_tech_contacts - visit registrant_domain_url(@domain) - - within('.tech-domain-contacts') do - assert_link 'William', href: registrant_domain_contact_path(@domain, contacts(:william)) - assert_text 'william-001' - assert_text 'william@inbox.test' - assert_css '.tech-domain-contact', count: 2 - end - end - - def test_registrant_user_cannot_access_domains_of_other_users - suppress(ActiveRecord::RecordNotFound) do - visit registrant_domain_url(domains(:metro)) - assert_response :not_found - assert_no_text 'metro.test' - 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 diff --git a/test/system/registrant_area/domains/domain_delete_confirms_test.rb b/test/system/registrant_area/domains/domain_delete_confirms_test.rb deleted file mode 100644 index 765cd0149..000000000 --- a/test/system/registrant_area/domains/domain_delete_confirms_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -require 'application_system_test_case' - -class DomainDeleteConfirmsTest < ApplicationSystemTestCase - include ActionMailer::TestHelper - setup do - @user = users(:registrant) - sign_in @user - - @domain = domains(:shop) - @domain.registrant_verification_asked!('\n', @user.id) - @domain.pending_delete! - end - - def test_enqueues_approve_job_after_verification - visit registrant_domain_delete_confirm_url(@domain.id, token: @domain.registrant_verification_token) - - perform_enqueued_jobs do - click_on 'Confirm domain delete' - end - assert_text 'Domain registrant change has successfully received.' - - @domain.reload - assert_includes @domain.statuses, 'serverHold' - end - - def test_enqueues_reject_job_after_verification - visit registrant_domain_delete_confirm_url(@domain.id, token: @domain.registrant_verification_token) - - perform_enqueued_jobs do - click_on 'Reject domain delete' - end - assert_text 'Domain registrant change has been rejected successfully.' - - @domain.reload - assert_equal ['ok'], @domain.statuses - end - - def test_saves_whodunnit_info_after_verifivation - visit registrant_domain_delete_confirm_url(@domain.id, token: @domain.registrant_verification_token) - token = @domain.registrant_verification_token - click_on 'Confirm domain delete' - assert_text 'Domain registrant change has successfully received.' - - refute RegistrantVerification.find_by(verification_token:token).updator_str.empty? - end -end diff --git a/test/system/registrant_area/domains/list_test.rb b/test/system/registrant_area/domains/list_test.rb deleted file mode 100644 index 3cbf477da..000000000 --- a/test/system/registrant_area/domains/list_test.rb +++ /dev/null @@ -1,71 +0,0 @@ -require 'application_system_test_case' - -CompanyRegisterClientStub = Struct.new(:any_method) do - def representation_rights(citizen_personal_code:, citizen_country_code:) - raise CompanyRegister::NotAvailableError - end -end - -class RegistrantAreaDomainListTest < ApplicationSystemTestCase - setup do - @user = users(:registrant) - sign_in @user - - @domain = domains(:shop) - end - - def test_show_domain_list - visit registrant_domains_url - assert_link 'shop.test', href: registrant_domain_path(@domain) - assert_link 'John', href: registrant_domain_contact_path(@domain, @domain.registrant) - assert_link 'Best Names', href: registrant_registrar_path(@domain.registrar) - assert_text l(Time.zone.parse('2010-07-05')) - assert_css '.domains .domain', count: 4 - end - - def test_do_not_show_domains_of_other_registrant_users - visit registrant_domains_url - assert_no_text 'metro.test' - end - - def test_only_shows_direct_relation_and_or_company_domains - # case https://github.com/internetee/registry/issues/1690 - tech_contact = contacts(:registrar_ltd) - - # All domains share the same tech contact object - Domain.all.each do |domain| - DomainContact.create(domain: domain, contact: tech_contact, type: TechDomainContact) - end - - visit registrant_domains_url - assert_no_text 'Company register is unavailable.' - assert_no_text 'metro.test' - end - - def test_notification_when_company_register_is_unavailable - CompanyRegister::Client.stub(:new, CompanyRegisterClientStub.new) do - visit registrant_domains_url - end - - assert_text 'Company register is unavailable. Domains and contacts associated via' \ - ' organizations are not shown.' - end - - def test_show_direct_domains_when_company_register_is_unavailable - assert_equal 'US-1234', @user.registrant_ident - - contact = contacts(:john) - assert_equal '1234', contact.ident - assert_equal Contact::PRIV, contact.ident_type - assert_equal 'US', contact.ident_country_code - - assert_equal contact.becomes(Registrant), @domain.registrant - assert_equal 'shop.test', @domain.name - - CompanyRegister::Client.stub(:new, CompanyRegisterClientStub.new) do - visit registrant_domains_url - end - - assert_text 'shop.test' - end -end diff --git a/test/system/registrant_area/domains_test.rb b/test/system/registrant_area/domains_test.rb deleted file mode 100644 index fa151c89e..000000000 --- a/test/system/registrant_area/domains_test.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'application_system_test_case' - -class RegistrantDomainsTest < ApplicationSystemTestCase - setup do - sign_in users(:registrant) - end - - def test_shows_domains_where_current_user_is_registrant - visit registrant_domains_url - assert_text 'shop.test' - end - - def test_shows_domains_where_current_user_is_contact_person - visit registrant_domains_url - assert_text 'airport.test' - end - - def test_shows_domains_where_current_user_has_associated_organizations - visit registrant_domains_url - assert_text 'library.test' - end -end diff --git a/test/system/registrant_area/layout_test.rb b/test/system/registrant_area/layout_test.rb deleted file mode 100644 index 9df8028e3..000000000 --- a/test/system/registrant_area/layout_test.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'application_system_test_case' - -class RegistrantLayoutTest < ApplicationSystemTestCase - def setup - super - sign_in(users(:registrant)) - end - - def test_has_link_to_rest_whois_and_internet_ee - visit registrant_domains_url - - assert(has_link?('Internet.ee', href: 'https://internet.ee')) - assert(has_link?('WHOIS', href: 'https://whois.internet.ee')) - end -end diff --git a/test/system/registrant_area/tara/tara_users_test.rb b/test/system/registrant_area/tara/tara_users_test.rb deleted file mode 100644 index 5020616d4..000000000 --- a/test/system/registrant_area/tara/tara_users_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'application_system_test_case' - -class RegistrantAreaTaraUsersTest < ApplicationSystemTestCase - def setup - super - - OmniAuth.config.test_mode = true - @registrant = users(:registrant) - - @existing_user_hash = { - 'provider' => 'rant_tara', - 'uid' => "US1234", - 'info': { 'first_name': 'Registrant', 'last_name': 'User' } - } - - @new_user_hash = { - 'provider' => 'rant_tara', - 'uid' => 'EE51007050604', - 'info': { 'first_name': 'New Registrant', 'last_name': 'User'} - } - end - - def teardown - super - - OmniAuth.config.test_mode = false - OmniAuth.config.mock_auth['rant_tara'] = nil - end - - def test_existing_user_gets_signed_in - OmniAuth.config.mock_auth[:rant_tara] = OmniAuth::AuthHash.new(@existing_user_hash) - - visit new_registrant_user_session_path - click_link('Sign in') - - assert_text('Signed in successfully') - end - - def test_new_user_is_created_and_signed_in - OmniAuth.config.mock_auth[:rant_tara] = OmniAuth::AuthHash.new(@new_user_hash) - - assert_difference 'RegistrantUser.count' do - visit new_registrant_user_session_path - click_link('Sign in') - - assert_equal 'New Registrant User', RegistrantUser.last.username - assert_equal 'EE-51007050604', RegistrantUser.last.registrant_ident - assert_text('Signed in successfully') - end - end -end