mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 05:26:17 +02:00
Fixed codeclimate issue
This commit is contained in:
parent
1dcfd1d414
commit
5c1cede31e
1 changed files with 7 additions and 7 deletions
|
@ -122,13 +122,9 @@ module Repp
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_ip_restriction
|
def check_ip_restriction
|
||||||
if webclient_request?
|
ip = webclient_request? ? request.headers['X-Client-IP'] : request.ip
|
||||||
ip = request.headers['X-Client-IP']
|
return if registrar_ip_white?(ip) && webclient_request?
|
||||||
return if registrar_ip_white?(ip)
|
return if api_ip_white?(ip) && !webclient_request?
|
||||||
else
|
|
||||||
ip = request.ip
|
|
||||||
return if @current_user.registrar.api_ip_white?(ip)
|
|
||||||
end
|
|
||||||
|
|
||||||
render_unauthorized_response(ip)
|
render_unauthorized_response(ip)
|
||||||
end
|
end
|
||||||
|
@ -139,6 +135,10 @@ module Repp
|
||||||
@current_user.registrar.registrar_ip_white?(ip)
|
@current_user.registrar.registrar_ip_white?(ip)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def api_ip_white?(ip)
|
||||||
|
@current_user.registrar.api_ip_white?(ip)
|
||||||
|
end
|
||||||
|
|
||||||
def render_unauthorized_response(ip)
|
def render_unauthorized_response(ip)
|
||||||
@response = { code: 2202, message: I18n.t('registrar.authorization.ip_not_allowed', ip: ip) }
|
@response = { code: 2202, message: I18n.t('registrar.authorization.ip_not_allowed', ip: ip) }
|
||||||
render json: @response, status: :unauthorized
|
render json: @response, status: :unauthorized
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue