diff --git a/app/assets/images/depp/.keep b/app/assets/images/registrar/.keep
similarity index 100%
rename from app/assets/images/depp/.keep
rename to app/assets/images/registrar/.keep
diff --git a/app/assets/images/depp/bg-alpha.png b/app/assets/images/registrar/bg-alpha.png
similarity index 100%
rename from app/assets/images/depp/bg-alpha.png
rename to app/assets/images/registrar/bg-alpha.png
diff --git a/app/assets/images/depp/bg-development.png b/app/assets/images/registrar/bg-development.png
similarity index 100%
rename from app/assets/images/depp/bg-development.png
rename to app/assets/images/registrar/bg-development.png
diff --git a/app/assets/images/depp/bg-staging.png b/app/assets/images/registrar/bg-staging.png
similarity index 100%
rename from app/assets/images/depp/bg-staging.png
rename to app/assets/images/registrar/bg-staging.png
diff --git a/app/assets/images/depp/favicon.ico b/app/assets/images/registrar/favicon.ico
similarity index 100%
rename from app/assets/images/depp/favicon.ico
rename to app/assets/images/registrar/favicon.ico
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 57a8f0c3c..73bb1dcf7 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -16,23 +16,32 @@ class ApplicationController < ActionController::Base
redirect_to registrar_root_path, alert: exception.message if current_user.is_a?(ApiUser)
end
+ helper_method :registrar_request?, :admin_request?
+ def registrar_request?
+ request.path.match(/^\/registrar/)
+ end
+
+ def admin_request?
+ request.path.match(/^\/admin/)
+ end
+
def after_sign_in_path_for(_resource)
rt = session[:user_return_to].to_s.presence
login_paths = [admin_login_path, registrar_login_path, '/login']
return rt if rt && !login_paths.include?(rt)
- if request.path.match('registrar')
- registrar_root_path
- elsif request.path.match('admin')
- admin_root_path
+ if registrar_request?
+ registrar_root_url
+ elsif admin_request?
+ admin_root_url
end
end
def after_sign_out_path_for(_resource)
- if request.path.match('registrar')
- registrar_login_path
- elsif request.path.match('admin')
- admin_login_path
+ if registrar_request?
+ registrar_login_url
+ elsif admin_request?
+ admin_login_url
end
end
diff --git a/app/controllers/registrar/contacts_controller.rb b/app/controllers/registrar/contacts_controller.rb
index 43c2bc4c9..a4a4e5bd2 100644
--- a/app/controllers/registrar/contacts_controller.rb
+++ b/app/controllers/registrar/contacts_controller.rb
@@ -32,7 +32,7 @@ class Registrar::ContactsController < Registrar::DeppController # EPP controller
def create
authorize! :create, Depp::Contact
- @contact = Depp::Contact.new(params[:contact])
+ @contact = Depp::Contact.new(params[:depp_contact])
if @contact.save
redirect_to registrar_contact_url(@contact.id)
@@ -43,9 +43,9 @@ class Registrar::ContactsController < Registrar::DeppController # EPP controller
def update
authorize! :edit, Depp::Contact
- @contact = Depp::Contact.new(params[:contact])
+ @contact = Depp::Contact.new(params[:depp_contact])
- if @contact.update_attributes(params[:contact])
+ if @contact.update_attributes(params[:depp_contact])
redirect_to registrar_contact_url(@contact.id)
else
render 'edit'
@@ -59,7 +59,7 @@ class Registrar::ContactsController < Registrar::DeppController # EPP controller
def destroy
authorize! :delete, Depp::Contact
- @contact = Depp::Contact.new(params[:contact])
+ @contact = Depp::Contact.new(params[:depp_contact])
if @contact.delete
redirect_to registrar_contacts_url, notice: t(:destroyed)
diff --git a/app/controllers/registrar/depp_controller.rb b/app/controllers/registrar/depp_controller.rb
index 6d7b891d1..d7ef823ec 100644
--- a/app/controllers/registrar/depp_controller.rb
+++ b/app/controllers/registrar/depp_controller.rb
@@ -1,11 +1,4 @@
class Registrar::DeppController < RegistrarController # EPP controller
- include CurrentUserHelper
- include Depp::ApplicationHelper
-
- # Prevent CSRF attacks by raising an exception.
- # For APIs, you may want to use :null_session instead.
- protect_from_forgery with: :exception
-
helper_method :depp_current_user
rescue_from(Errno::ECONNRESET, Errno::ECONNREFUSED) do |_exception|
diff --git a/app/controllers/registrar/xml_consoles_controller.rb b/app/controllers/registrar/xml_consoles_controller.rb
index f51c4a86c..83c20383b 100644
--- a/app/controllers/registrar/xml_consoles_controller.rb
+++ b/app/controllers/registrar/xml_consoles_controller.rb
@@ -14,9 +14,9 @@ class Registrar::XmlConsolesController < Registrar::DeppController # EPP control
end
def load_xml
- # binding.pry
- cl_trid = "#{depp_current_user.tag}-#{Time.now.to_i}"
- xml_dir_path = Depp::Engine.root + 'app/views/depp/xml_consoles/epp_requests'
+ authorize! :create, :registrar_xml_console
+ cl_trid = "#{depp_current_user.tag}-#{Time.zone.now.to_i}"
+ xml_dir_path = Rails.root + 'app/views/registrar/xml_consoles/epp_requests'
xml = File.read("#{xml_dir_path}/#{params[:obj]}/#{params[:epp_action]}.xml")
xml.gsub!('ABC-12345', "#{cl_trid}")
render text: xml
diff --git a/app/controllers/registrar_controller.rb b/app/controllers/registrar_controller.rb
index 4e2def023..d6a502b88 100644
--- a/app/controllers/registrar_controller.rb
+++ b/app/controllers/registrar_controller.rb
@@ -2,6 +2,8 @@ class RegistrarController < ApplicationController
before_action :authenticate_user!
layout 'registrar/application'
+ include Registrar::ApplicationHelper
+
helper_method :depp_controller?
def depp_controller?
false
diff --git a/app/helpers/current_user_helper.rb b/app/helpers/current_user_helper.rb
deleted file mode 100644
index 80b97c998..000000000
--- a/app/helpers/current_user_helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module CurrentUserHelper
-end
diff --git a/app/helpers/depp/application_helper.rb b/app/helpers/depp/application_helper.rb
deleted file mode 100644
index de11f9f3d..000000000
--- a/app/helpers/depp/application_helper.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-module Depp
- module ApplicationHelper
- def unstable_env
- return nil if Rails.env.production?
- Rails.env
- end
-
- def env_style
- return '' if unstable_env.nil?
- "background-image: url(#{image_path("depp/bg-#{unstable_env}.png")});"
- end
-
- def ident_for(contact)
- case contact.ident_type
- when 'birthday'
- "#{contact.ident} [#{contact.ident_type}]"
- else
- "#{contact.ident} [#{contact.ident_country_code} #{contact.ident_type}]"
- end
- end
-
- def pagination_details
- params[:page] ||= 1
- limit = ENV['depp_records_on_page'] || 20
- offset = ((params[:page].to_i - 1) * limit.to_i)
- [limit, offset]
- end
- end
-end
diff --git a/app/helpers/registrar/application_helper.rb b/app/helpers/registrar/application_helper.rb
new file mode 100644
index 000000000..83985b703
--- /dev/null
+++ b/app/helpers/registrar/application_helper.rb
@@ -0,0 +1,15 @@
+module Registrar
+ module ApplicationHelper
+ def env_style
+ return '' if unstable_env.nil?
+ "background-image: url(#{image_path("registrar/bg-#{unstable_env}.png")});"
+ end
+
+ def pagination_details
+ params[:page] ||= 1
+ limit = ENV['depp_records_on_page'] || 20
+ offset = ((params[:page].to_i - 1) * limit.to_i)
+ [limit, offset]
+ end
+ end
+end
diff --git a/app/models/depp/contact.rb b/app/models/depp/contact.rb
index ba6bc5d84..9ec85a7b1 100644
--- a/app/models/depp/contact.rb
+++ b/app/models/depp/contact.rb
@@ -48,14 +48,15 @@ module Depp
data = info_xml(id)
res = data.css('epp response resData infData')
+ ext = data.css('epp response extension')
new(
id: res.css('id').text,
code: res.css('id').text,
email: res.css('email').text,
phone: res.css('voice').text,
- ident: res.css('ident').text,
- ident_type: res.css('ident').first.try(:attributes).try(:[], 'type').try(:value),
- ident_country_code: res.css('ident').first.try(:attributes).try(:[], 'cc').try(:value),
+ ident: ext.css('ident').text,
+ ident_type: ext.css('ident').first.try(:attributes).try(:[], 'type').try(:value),
+ ident_country_code: ext.css('ident').first.try(:attributes).try(:[], 'cc').try(:value),
# postalInfo
name: res.css('postalInfo name').text,
diff --git a/app/views/layouts/registrar/application.haml b/app/views/layouts/registrar/application.haml
index fbd4b8307..6c766fc6b 100644
--- a/app/views/layouts/registrar/application.haml
+++ b/app/views/layouts/registrar/application.haml
@@ -8,7 +8,7 @@
= csrf_meta_tags
= stylesheet_link_tag 'registrar-manifest', media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag 'application', 'data-turbolinks-track' => true
- = favicon_link_tag 'favicon.ico'
+ = favicon_link_tag 'registrar/favicon.ico'
%title EIS Registrar Portal
%body
/ Static navbar