mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 03:06:14 +02:00
Merge branch 'master' into improve-registrant-area
This commit is contained in:
commit
d27443277f
111 changed files with 947 additions and 705 deletions
|
@ -4,7 +4,6 @@ class Registrant::ContactsController < RegistrantController
|
|||
|
||||
def show
|
||||
@contact = Contact.where(id: contacts).find_by(id: params[:id])
|
||||
@current_user = current_user
|
||||
|
||||
authorize! :read, @contact
|
||||
end
|
||||
|
@ -23,7 +22,7 @@ class Registrant::ContactsController < RegistrantController
|
|||
|
||||
def domain_ids
|
||||
@domain_ids ||= begin
|
||||
ident_cc, ident = @current_user.registrant_ident.to_s.split '-'
|
||||
ident_cc, ident = current_registrant_user.registrant_ident.to_s.split '-'
|
||||
BusinessRegistryCache.fetch_by_ident_and_cc(ident, ident_cc).associated_domain_ids
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,8 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
|
|||
domain_name: @domain.name,
|
||||
verification_token: params[:token])
|
||||
|
||||
initiator = current_user ? current_user.username : t(:user_not_authenticated)
|
||||
initiator = current_registrant_user ? current_registrant_user.username :
|
||||
t(:user_not_authenticated)
|
||||
|
||||
if params[:rejected]
|
||||
if @registrant_verification.domain_registrant_delete_reject!("email link #{initiator}")
|
||||
|
|
|
@ -19,7 +19,8 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
|
|||
domain_name: @domain.name,
|
||||
verification_token: params[:token])
|
||||
|
||||
initiator = current_user ? current_user.username : t(:user_not_authenticated)
|
||||
initiator = current_registrant_user ? current_registrant_user.username :
|
||||
t(:user_not_authenticated)
|
||||
|
||||
if params[:rejected]
|
||||
if @registrant_verification.domain_registrant_change_reject!("email link, #{initiator}")
|
||||
|
|
|
@ -54,13 +54,13 @@ class Registrant::DomainsController < RegistrantController
|
|||
end
|
||||
|
||||
def domains
|
||||
ident_cc, ident = @current_user.registrant_ident.split '-'
|
||||
ident_cc, ident = current_registrant_user.registrant_ident.split '-'
|
||||
begin
|
||||
BusinessRegistryCache.fetch_associated_domains ident, ident_cc
|
||||
rescue Soap::Arireg::NotAvailableError => error
|
||||
flash[:notice] = I18n.t(error.json[:message])
|
||||
Rails.logger.fatal("[EXCEPTION] #{error.to_s}")
|
||||
current_user.domains
|
||||
current_registrant_user.domains
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
class Registrant::SessionsController < Devise::SessionsController
|
||||
layout 'registrant/application'
|
||||
|
||||
def login
|
||||
end
|
||||
def new; end
|
||||
|
||||
def id
|
||||
id_code, id_issuer = request.env['SSL_CLIENT_S_DN'], request.env['SSL_CLIENT_I_DN_O']
|
||||
|
@ -10,11 +9,10 @@ class Registrant::SessionsController < Devise::SessionsController
|
|||
|
||||
@user = RegistrantUser.find_or_create_by_idc_data(id_code, id_issuer)
|
||||
if @user
|
||||
sign_in(@user, event: :authentication)
|
||||
redirect_to registrant_root_url
|
||||
sign_in_and_redirect(:registrant_user, @user, event: :authentication)
|
||||
else
|
||||
flash[:alert] = t('login_failed_check_id_card')
|
||||
redirect_to registrant_login_url
|
||||
redirect_to new_registrant_user_session_url
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -68,7 +66,7 @@ class Registrant::SessionsController < Devise::SessionsController
|
|||
when 'USER_AUTHENTICATED'
|
||||
@user = RegistrantUser.find_by(registrant_ident: "#{session[:user_country]}-#{session[:user_id_code]}")
|
||||
|
||||
sign_in @user
|
||||
sign_in(:registrant_user, @user)
|
||||
flash[:notice] = t(:welcome)
|
||||
flash.keep(:notice)
|
||||
render js: "window.location = '#{registrant_root_path}'"
|
||||
|
@ -97,4 +95,18 @@ class Registrant::SessionsController < Devise::SessionsController
|
|||
return User.new unless idc
|
||||
ApiUser.find_by(identity_code: idc) || User.new
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def after_sign_in_path_for(_resource_or_scope)
|
||||
registrant_root_path
|
||||
end
|
||||
|
||||
def after_sign_out_path_for(_resource_or_scope)
|
||||
new_registrant_user_session_path
|
||||
end
|
||||
|
||||
def user_for_paper_trail
|
||||
current_registrant_user.present? ? current_registrant_user.id_role_username : 'anonymous'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue