mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 17:01:44 +02:00
Update registrar sessions
This commit is contained in:
parent
936c570e1f
commit
e72bb0be54
5 changed files with 43 additions and 7 deletions
|
@ -45,6 +45,18 @@ class Registrar::SessionsController < ::SessionsController
|
|||
# rubocop:enable Metrics/CyclomaticComplexity
|
||||
# rubocop:enable Metrics/PerceivedComplexity
|
||||
|
||||
def id
|
||||
@user = ApiUser.find_by_idc_data(request.env['SSL_CLIENT_S_DN'])
|
||||
|
||||
if @user
|
||||
sign_in(@user, event: :authentication)
|
||||
redirect_to registrant_root_url
|
||||
else
|
||||
flash[:alert] = t('no_such_user')
|
||||
redirect_to registrar_login_url
|
||||
end
|
||||
end
|
||||
|
||||
def login_mid
|
||||
@user = User.new
|
||||
end
|
||||
|
@ -55,7 +67,7 @@ class Registrar::SessionsController < ::SessionsController
|
|||
|
||||
if Rails.env.test? && phone == "123"
|
||||
@user = ApiUser.find_by(identity_code: "14212128025")
|
||||
sign_in(@user, event: :authentication)
|
||||
sign_in(@user, event: :authentication)
|
||||
return redirect_to registrar_root_url
|
||||
end
|
||||
|
||||
|
|
|
@ -42,5 +42,14 @@ class ApiUser < User
|
|||
def queued_messages
|
||||
registrar.messages.queued
|
||||
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
|
||||
# rubocop: enable Metrics/ClassLength
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
%hr
|
||||
= link_to '/registrar/login/mid' do
|
||||
= image_tag 'mid.gif'
|
||||
-# = link_to '/registrar/login/id' do
|
||||
-# = image_tag 'id_card.gif'
|
||||
= link_to '/registrar/id', method: :post do
|
||||
= image_tag 'id_card.gif'
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue