mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
while logging in with id/mid pick only users who have whitelisted ip
This commit is contained in:
parent
1c6d47380f
commit
06049cd22f
2 changed files with 30 additions and 3 deletions
|
@ -51,6 +51,21 @@ class ApiUser < User
|
|||
|
||||
find_by(identity_code: identity_code)
|
||||
end
|
||||
|
||||
def find_by_idc_data_and_allowed(idc_data,ip)
|
||||
return false if idc_data.blank?
|
||||
identity_code = idc_data.scan(/serialNumber=(\d+)/).flatten.first
|
||||
|
||||
return false if ip.blank?
|
||||
possible_users = where(identity_code: identity_code)
|
||||
for i in 0..possible_users.count
|
||||
if possible_users[i].registrar.white_ips.registrar_area.include_ip?(ip)
|
||||
break
|
||||
end
|
||||
end
|
||||
possible_users[i]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def registrar_typeahead
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue