mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Expand TARA auth flow to registrant portal
This commit is contained in:
parent
248c984443
commit
04f0ef9a93
7 changed files with 85 additions and 27 deletions
|
@ -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