mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 19:48:28 +02:00
Merge remote-tracking branch 'origin/master' into 1580-registrar-api-contacts-endpoint
This commit is contained in:
commit
a80d037677
37 changed files with 376 additions and 411 deletions
|
@ -47,12 +47,6 @@ class ApiUser < User
|
|||
self.active = true unless saved_change_to_active?
|
||||
end
|
||||
|
||||
class << self
|
||||
def find_by_id_card(id_card)
|
||||
find_by(identity_code: id_card.personal_code)
|
||||
end
|
||||
end
|
||||
|
||||
def to_s
|
||||
username
|
||||
end
|
||||
|
|
|
@ -489,7 +489,7 @@ class Domain < ApplicationRecord
|
|||
end
|
||||
|
||||
def pending_update?
|
||||
statuses.include?(DomainStatus::PENDING_UPDATE) && !statuses.include?(DomainStatus::FORCE_DELETE)
|
||||
statuses.include?(DomainStatus::PENDING_UPDATE)
|
||||
end
|
||||
|
||||
# depricated not used, not valid
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
class IdCard
|
||||
attr_accessor :first_name
|
||||
attr_accessor :last_name
|
||||
attr_accessor :personal_code
|
||||
attr_accessor :country_code
|
||||
end
|
|
@ -1,7 +1,7 @@
|
|||
class RegistrantUser < User
|
||||
attr_accessor :idc_data
|
||||
|
||||
devise :trackable, :timeoutable, :id_card_authenticatable
|
||||
devise :trackable, :timeoutable
|
||||
|
||||
def ability
|
||||
@ability ||= Ability.new(self)
|
||||
|
@ -66,23 +66,19 @@ class RegistrantUser < User
|
|||
find_or_create_by_user_data(user_data)
|
||||
end
|
||||
|
||||
def find_or_create_by_mid_data(response)
|
||||
user_data = { first_name: response.user_givenname, last_name: response.user_surname,
|
||||
ident: response.user_id_code, country_code: response.user_country }
|
||||
def find_or_create_by_omniauth_data(omniauth_hash)
|
||||
uid = omniauth_hash['uid']
|
||||
identity_code = uid.slice(2..-1)
|
||||
country_code = uid.slice(0..1)
|
||||
first_name = omniauth_hash.dig('info', 'first_name')
|
||||
last_name = omniauth_hash.dig('info', 'last_name')
|
||||
|
||||
user_data = { first_name: first_name, last_name: last_name,
|
||||
ident: identity_code, country_code: country_code }
|
||||
|
||||
find_or_create_by_user_data(user_data)
|
||||
end
|
||||
|
||||
def find_by_id_card(id_card)
|
||||
registrant_ident = "#{id_card.country_code}-#{id_card.personal_code}"
|
||||
username = [id_card.first_name, id_card.last_name].join("\s")
|
||||
|
||||
user = find_or_initialize_by(registrant_ident: registrant_ident)
|
||||
user.username = username
|
||||
user.save!
|
||||
user
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_or_create_by_user_data(user_data = {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue