diff --git a/app/controllers/idv/enter_password_controller.rb b/app/controllers/idv/enter_password_controller.rb index 64768ea7ec8..c91ab6044a3 100644 --- a/app/controllers/idv/enter_password_controller.rb +++ b/app/controllers/idv/enter_password_controller.rb @@ -127,7 +127,7 @@ def confirm_current_password end def init_profile - idv_session.create_profile_from_applicant_with_password( + profile = idv_session.create_profile_from_applicant_with_password( password, is_enhanced_ipp: resolved_authn_context_result.enhanced_ipp?, proofing_components: ProofingComponents.new( @@ -137,12 +137,13 @@ def init_profile user_session:, ).to_h, ) - if idv_session.verify_by_mail? + + if profile.gpo_verification_pending? current_user.send_email_to_all_addresses(:verify_by_mail_letter_requested) log_letter_enqueued_analytics(resend: false) end - if idv_session.profile.active? + if profile.active? create_user_event(:account_verified) UserAlerts::AlertUserAboutAccountVerified.call( profile: idv_session.profile, diff --git a/app/services/idv/session.rb b/app/services/idv/session.rb index 071ce403a80..f7f48f83add 100644 --- a/app/services/idv/session.rb +++ b/app/services/idv/session.rb @@ -105,6 +105,7 @@ def respond_to_missing?(method_sym, include_private) VALID_SESSION_ATTRIBUTES.include?(attr_name_sym) || super end + # @return [Profile] def create_profile_from_applicant_with_password( user_password, is_enhanced_ipp:, proofing_components: ) @@ -141,6 +142,8 @@ def create_profile_from_applicant_with_password( if profile.gpo_verification_pending? create_gpo_entry(profile_maker.pii_attributes, profile) end + + profile end def opt_in_param