mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Added basic Registrant portal
This commit is contained in:
parent
90633160c0
commit
fdcad95683
28 changed files with 810 additions and 26 deletions
32
app/controllers/registrant/depp_controller.rb
Normal file
32
app/controllers/registrant/depp_controller.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
class Registrant::DeppController < RegistrantController # EPP controller
|
||||
helper_method :depp_current_user
|
||||
|
||||
rescue_from(Errno::ECONNRESET, Errno::ECONNREFUSED) do |_exception|
|
||||
redirect_to registrant_login_url, alert: t(:no_connection_to_registry)
|
||||
end
|
||||
|
||||
before_action :authenticate_user
|
||||
def authenticate_user
|
||||
redirect_to registrant_login_url and return unless depp_current_user
|
||||
end
|
||||
|
||||
def depp_controller?
|
||||
true
|
||||
end
|
||||
|
||||
def depp_current_user
|
||||
return nil unless current_user
|
||||
@depp_current_user ||= Depp::User.new(
|
||||
tag: current_user.username,
|
||||
password: current_user.password
|
||||
)
|
||||
end
|
||||
|
||||
def response_ok?
|
||||
@data.css('result').each do |x|
|
||||
success_codes = %(1000, 1001, 1300, 1301)
|
||||
return false unless success_codes.include?(x['code'])
|
||||
end
|
||||
true
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue