mirror of
https://github.com/internetee/registry.git
synced 2025-05-21 19:59:38 +02:00
Ignore empty identity for regisrar user switch #2754
This commit is contained in:
parent
85e5a17509
commit
598ab7ba63
4 changed files with 32 additions and 11 deletions
|
@ -40,6 +40,20 @@ class ApiUser < User
|
|||
self.active = true unless active_changed?
|
||||
end
|
||||
|
||||
class << self
|
||||
def find_by_idc_data(idc_data)
|
||||
return false if idc_data.blank?
|
||||
identity_code = idc_data.scan(/serialNumber=(\d+)/).flatten.first
|
||||
|
||||
find_by(identity_code: identity_code)
|
||||
end
|
||||
|
||||
def all_by_identity_code(identity_code)
|
||||
ApiUser.where(identity_code: identity_code)
|
||||
.where("identity_code is NOT NULL and identity_code != ''").includes(:registrar)
|
||||
end
|
||||
end
|
||||
|
||||
def registrar_typeahead
|
||||
@registrar_typeahead || registrar || nil
|
||||
end
|
||||
|
@ -75,13 +89,4 @@ class ApiUser < User
|
|||
md5 = OpenSSL::Digest::MD5.new(cert.to_der).to_s
|
||||
certificates.api.exists?(md5: md5, common_name: cn)
|
||||
end
|
||||
|
||||
class << self
|
||||
def find_by_idc_data(idc_data)
|
||||
return false if idc_data.blank?
|
||||
identity_code = idc_data.scan(/serialNumber=(\d+)/).flatten.first
|
||||
|
||||
find_by(identity_code: identity_code)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue