mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
fix some of the style bugs
This commit is contained in:
parent
af31230285
commit
3f1c36bd9a
2 changed files with 10 additions and 10 deletions
|
@ -53,7 +53,7 @@ class Registrar
|
||||||
end
|
end
|
||||||
|
|
||||||
def id
|
def id
|
||||||
@user = ApiUser.find_by_idc_data_and_allowed(request.env['SSL_CLIENT_S_DN'],request.ip)
|
@user = ApiUser.find_by_idc_data_and_allowed(request.env['SSL_CLIENT_S_DN'], request.ip)
|
||||||
|
|
||||||
if @user
|
if @user
|
||||||
sign_in(@user, event: :authentication)
|
sign_in(@user, event: :authentication)
|
||||||
|
@ -156,11 +156,11 @@ class Registrar
|
||||||
def find_user_by_idc_and_allowed(idc)
|
def find_user_by_idc_and_allowed(idc)
|
||||||
return User.new unless idc
|
return User.new unless idc
|
||||||
possible_users = ApiUser.where(identity_code: idc) || User.new
|
possible_users = ApiUser.where(identity_code: idc) || User.new
|
||||||
for i in 0..possible_users.count
|
for i in 0..possible_users.count
|
||||||
if possible_users[i].registrar.white_ips.registrar_area.include_ip?(request.ip)
|
if possible_users[i].registrar.white_ips.registrar_area.include_ip?(request.ip)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
possible_users[i]
|
possible_users[i]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -52,16 +52,16 @@ class ApiUser < User
|
||||||
find_by(identity_code: identity_code)
|
find_by(identity_code: identity_code)
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_by_idc_data_and_allowed(idc_data,ip)
|
def find_by_idc_data_and_allowed(idc_data, ip)
|
||||||
return false if idc_data.blank?
|
return false if idc_data.blank?
|
||||||
identity_code = idc_data.scan(/serialNumber=(\d+)/).flatten.first
|
identity_code = idc_data.scan(/serialNumber=(\d+)/).flatten.first
|
||||||
|
|
||||||
return false if ip.blank?
|
return false if ip.blank?
|
||||||
possible_users = where(identity_code: identity_code)
|
possible_users = where(identity_code: identity_code)
|
||||||
for i in 0..possible_users.count
|
for i in 0..possible_users.count
|
||||||
if possible_users[i].registrar.white_ips.registrar_area.include_ip?(ip)
|
if possible_users[i].registrar.white_ips.registrar_area.include_ip?(ip)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
possible_users[i]
|
possible_users[i]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue