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
7 changes: 7 additions & 0 deletions app/controllers/concerns/idv_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,11 @@ def idv_session
def idv_attempter_throttled?
Throttler::IsThrottled.call(current_user.id, :idv_resolution)
end

def sp_context_needed?
return if sp_from_sp_session.present?
return if LoginGov::Hostdata.env != 'prod'

redirect_to account_url
end
end
1 change: 1 addition & 0 deletions app/controllers/idv_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class IdvController < ApplicationController
before_action :confirm_two_factor_authenticated
before_action :confirm_idv_needed, only: [:fail]
before_action :profile_needs_reactivation?, only: [:index]
before_action :sp_context_needed?, only: [:index]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this only applies to :index, and only the root IdvController, what would happen if I navigate to /verify/doc_auth or /verify/doc_auth/welcome ? Or are we primarily concerned with the base /verify path?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #4543 to block all {{/verify/*}} paths (which proved to be a bad idea...)


def index
if decorated_session.requested_more_recent_verification?
Expand Down
31 changes: 31 additions & 0 deletions spec/controllers/idv_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,37 @@
expect(response).to redirect_to account_url
end
end

context 'no SP context' do
before do
stub_sign_in
session[:sp] = {}
end

context 'prod environment' do
before do
allow(LoginGov::Hostdata).to receive(:env).and_return('prod')
end

it 'redirects back to the account page' do
get :index

expect(response).to redirect_to account_url
end
end

context 'non-prod environment' do
before do
allow(LoginGov::Hostdata).to receive(:env).and_return('staging')
end

it 'begins the identity proofing process' do
get :index

expect(response).to redirect_to idv_doc_auth_url
end
end
end
end

describe '#activated' do
Expand Down