Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions app/controllers/concerns/inherited_proofing_session.rb

This file was deleted.

50 changes: 22 additions & 28 deletions app/controllers/idv/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
module Idv
class SessionsController < ApplicationController
include IdvSession
include InheritedProofingSession
include InheritedProofingConcern

before_action :confirm_two_factor_authenticated

def destroy
destroy_idv
destroy_inherited_proofing if inherited_proofing?
cancel_verification_attempt_if_pending_profile
cancel_in_person_enrollment_if_exists
cancel_inherited_proofing_if_exists
analytics.idv_start_over(
step: location_params[:step],
location: location_params[:location],
)
user_session['idv/doc_auth'] = {}
user_session['idv/in_person'] = {}
user_session['idv/inherited_proofing'] = {}
idv_session.clear
Pii::Cacher.new(current_user, user_session).delete
redirect_to idv_url
end

private

def location_params
params.permit(:step, :location).to_h.symbolize_keys
end

def destroy_idv
cancel_processing
clear_session
log_analytics
end

def cancel_processing
cancel_verification_attempt_if_pending_profile
cancel_in_person_enrollment_if_exists
end

def cancel_verification_attempt_if_pending_profile
return if current_user.profiles.gpo_verification_pending.blank?
Idv::CancelVerificationAttempt.new(user: current_user).call
Expand All @@ -40,18 +35,17 @@ def cancel_in_person_enrollment_if_exists
cancel_stale_establishing_enrollments_for_user(current_user)
end

def clear_session
user_session['idv/doc_auth'] = {}
user_session['idv/in_person'] = {}
idv_session.clear
Pii::Cacher.new(current_user, user_session).delete
def cancel_inherited_proofing_if_exists
return if !inherited_proofing?
# LG-7128: Implement Inherited Proofing analytics here.
# analytics.inherited_proofing_start_over(
# step: location_params[:step],
# location: location_params[:location],
# )
Comment thread
gangelo marked this conversation as resolved.
end

def log_analytics
analytics.idv_start_over(
step: location_params[:step],
location: location_params[:location],
)
def location_params
params.permit(:step, :location).to_h.symbolize_keys
end
end
end
6 changes: 3 additions & 3 deletions spec/controllers/idv/sessions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end
end

shared_examples 'a redirect occurs to the start of identity verificaton' do
shared_examples 'a redirect occurs to the start of identity verification' do
it 'redirects' do
delete :destroy

Expand Down Expand Up @@ -121,7 +121,7 @@
# so that analytics can be logged, throttling and quotes can be
# properly checked; this could not take place if we simply redirected
# to idv_inherited_proofing_url.
it_behaves_like 'a redirect occurs to the start of identity verificaton'
it_behaves_like 'a redirect occurs to the start of identity verification'
it_behaves_like 'logs IDV start over analytics with step and location params'
it_behaves_like 'logs Inherited Proofing start over analytics with step and location params'
end
Expand All @@ -139,7 +139,7 @@
end

it_behaves_like 'logs IDV start over analytics with step and location params'
it_behaves_like 'a redirect occurs to the start of identity verificaton'
it_behaves_like 'a redirect occurs to the start of identity verification'

context 'pending profile' do
let(:user) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,5 @@
require 'rails_helper'

# rubocop:disable Layout/LineLength
shared_examples 'steps up to "Get started..." are completed' do
it 'should have current path equal to the Getting Started page' do
expect(page).to have_current_path(/inherited_proofing[?|\/].*get_started/)
end
end

shared_examples 'steps up to "How verifying..." are completed' do
it 'should have current path equal to the How Verifying (agreement step) page' do
expect(page).to have_current_path(/inherited_proofing[?|\/].*agreement/)
end
end

shared_examples 'steps up to "We are retrieving..." are completed' do
it 'should have current path equal to the We are retrieving (verify_wait step) page' do
expect(page).to have_current_path(/inherited_proofing[?|\/].*verify_wait/)
end
end

shared_examples 'steps up to "Verify your information..." are completed' do
it 'should have current path equal to the Verify your information (verify_info step) page' do
expect(page).to have_current_path(/inherited_proofing[?|\/].*verify_info/)
end
end

shared_examples 'the user is redirected to the Cancellation View' do
it 'redirects to the Cancellations view' do
expect(page).to have_current_path(idv_inherited_proofing_cancel_path(step: :get_started))
end
end

# Simulates a user (in this case, a VA inherited proofing-authorized user)
# coming over to login.gov from a service provider, and hitting the
# OpenidConnect::AuthorizationController#index action.
Expand Down Expand Up @@ -60,8 +29,10 @@ def complete_idv_steps_up_to_inherited_proofing_how_verifying_step(user, expect_

def complete_idv_steps_up_to_inherited_proofing_we_are_retrieving_step(user,
expect_accessible: false)
complete_idv_steps_up_to_inherited_proofing_how_verifying_step user,
expect_accessible: expect_accessible
complete_idv_steps_up_to_inherited_proofing_how_verifying_step(
user,
expect_accessible: expect_accessible,
)
unless current_path.match?(/inherited_proofing[?|\/].*verify_wait/)
check t('inherited_proofing.instructions.consent', app_name: APP_NAME), allow_label_click: true
click_on t('inherited_proofing.buttons.continue')
Expand Down Expand Up @@ -93,7 +64,9 @@ def complete_idv_steps_up_to_inherited_proofing_verify_your_info_step(user,
complete_idv_steps_up_to_inherited_proofing_get_started_step user
end

it_behaves_like 'steps up to "Get started..." are completed'
it 'should have current path equal to the Getting Started page' do
expect(page).to have_current_path(/inherited_proofing[?|\/].*get_started/)
end

context 'when clicking the "Start Over" button from the "Cancel" view' do
before do
Expand Down Expand Up @@ -137,7 +110,9 @@ def complete_idv_steps_up_to_inherited_proofing_verify_your_info_step(user,
complete_idv_steps_up_to_inherited_proofing_how_verifying_step user
end

it_behaves_like 'steps up to "How verifying..." are completed'
it 'should have current path equal to the How Verifying (agreement step) page' do
expect(page).to have_current_path(/inherited_proofing[?|\/].*agreement/)
end

context 'when clicking the "Start Over" button from the "Cancel" view' do
before do
Expand Down Expand Up @@ -180,18 +155,21 @@ def complete_idv_steps_up_to_inherited_proofing_verify_your_info_step(user,
# includes ActiveJob to move to the next step. Marking the necessary step as completed below,
# does not seem to do the trick for some reason. This has been manually verified in the
# meantime.
xcontext 'from the "We are retrieving your information..." view, and clicking the "Cancel" link' do
xcontext 'from the "We are retrieving your information..." view, and clicking "Cancel"' do
before do
allow_any_instance_of(Idv::Steps::InheritedProofing::AgreementStep).to receive(:enqueue_job).and_wrap_original do |target, *args|
target.receiver.mark_step_complete(:agreement)
# Omit the original call.
# target.call(*args)
nil
end
allow_any_instance_of(Idv::Steps::InheritedProofing::AgreementStep).
to receive(:enqueue_job).and_wrap_original do |target, *args|
target.receiver.mark_step_complete(:agreement)
# Omit the original call.
# target.call(*args)
nil
end
complete_idv_steps_up_to_inherited_proofing_we_are_retrieving_step user
end

it_behaves_like 'steps up to "We are retrieving..." are completed'
it 'should have current path equal to the We are retrieving (verify_wait step) page' do
expect(page).to have_current_path(/inherited_proofing[?|\/].*verify_wait/)
end

context 'when clicking the "Start Over" button from the "Cancel" view' do
before do
Expand Down Expand Up @@ -235,7 +213,9 @@ def complete_idv_steps_up_to_inherited_proofing_verify_your_info_step(user,
complete_idv_steps_up_to_inherited_proofing_verify_your_info_step user
end

it_behaves_like 'steps up to "Verify your information..." are completed'
it 'should have current path equal to the Verify your information (verify_info step) page' do
expect(page).to have_current_path(/inherited_proofing[?|\/].*verify_info/)
end

context 'when clicking the "Start Over" button from the "Cancel" view' do
before do
Expand Down Expand Up @@ -275,4 +255,3 @@ def complete_idv_steps_up_to_inherited_proofing_verify_your_info_step(user,
end
end
end
# rubocop:enable Layout/LineLength