Class: Login::AfterLoginActions

Inherits:
Object
  • Object
show all
Includes:
Accountable
Defined in:
app/services/login/after_login_actions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Accountable

#account_login_stats, #log_error, #no_account_log_message, #update_account_login_stats, #verification_level

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata

Constructor Details

#initialize(user, skip_mhv_account_creation) ⇒ AfterLoginActions

Returns a new instance of AfterLoginActions.



11
12
13
14
# File 'app/services/login/after_login_actions.rb', line 11

def initialize(user, )
  @current_user = user
  @skip_mhv_account_creation = 
end

Instance Attribute Details

#current_userObject (readonly)

Returns the value of attribute current_user.



9
10
11
# File 'app/services/login/after_login_actions.rb', line 9

def current_user
  @current_user
end

#skip_mhv_account_creationObject (readonly)

Returns the value of attribute skip_mhv_account_creation.



9
10
11
# File 'app/services/login/after_login_actions.rb', line 9

def 
  @skip_mhv_account_creation
end

Instance Method Details

#check_id_mismatch(identity_value, mpi_value, error_message) ⇒ Object (private)



55
56
57
58
59
60
61
62
63
# File 'app/services/login/after_login_actions.rb', line 55

def check_id_mismatch(identity_value, mpi_value, error_message)
  return if mpi_value.blank?

  if identity_value != mpi_value
    error_data = { icn: current_user.icn }
    error_data.merge!(identity_value:, mpi_value:) unless error_message.include?('SSN')
    Rails.logger.warn("[SessionsController version:v1] #{error_message}", error_data)
  end
end

#create_mhv_accountObject (private)



34
35
36
37
38
# File 'app/services/login/after_login_actions.rb', line 34

def 
  return if 

  current_user.
end

#id_mismatch_validationsObject (private)



44
45
46
47
48
49
50
51
52
53
# File 'app/services/login/after_login_actions.rb', line 44

def id_mismatch_validations
  return unless current_user.loa3?

  check_id_mismatch(current_user.identity.ssn, current_user.ssn_mpi, 'User Identity & MPI SSN values conflict')
  check_id_mismatch(current_user.identity.icn, current_user.mpi_icn, 'User Identity & MPI ICN values conflict')
  check_id_mismatch(current_user.identity.edipi, current_user.edipi_mpi,
                    'User Identity & MPI EDIPI values conflict')
  check_id_mismatch(current_user.identity.mhv_correlation_id, current_user.mpi_mhv_correlation_id,
                    'User Identity & MPI MHV Correlation ID values conflict')
end

#login_typeObject (private)



40
41
42
# File 'app/services/login/after_login_actions.rb', line 40

def 
  @login_type ||= current_user.identity.[:service_name]
end

#performObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/services/login/after_login_actions.rb', line 16

def perform
  return unless current_user

  Login::UserCredentialEmailUpdater.new(credential_email: current_user.email,
                                        user_verification: current_user.user_verification).perform
  Login::UserAcceptableVerifiedCredentialUpdater.new(user_account: @current_user.).perform
  ()
  id_mismatch_validations
  

  if Settings.test_user_dashboard.env == 'staging'
    TestUserDashboard::UpdateUser.new(current_user).call(Time.current)
    TestUserDashboard::AccountMetrics.new(current_user).checkout
  end
end