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
4 changes: 2 additions & 2 deletions app/controllers/concerns/idv_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module IdvSession
extend ActiveSupport::Concern

def confirm_idv_session_started
redirect_to idv_session_url if idv_session.applicant.blank?
redirect_to idv_doc_auth_url if idv_session.applicant.blank?
end

def confirm_idv_attempts_allowed
Expand All @@ -17,7 +17,7 @@ def confirm_idv_needed

def confirm_idv_vendor_session_started
return if flash[:allow_confirmations_continue]
redirect_to idv_session_url unless idv_session.proofing_started?
redirect_to idv_doc_auth_url unless idv_session.proofing_started?
end

def idv_session
Expand Down
55 changes: 0 additions & 55 deletions app/controllers/idv/jurisdiction_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,7 @@ class JurisdictionController < ApplicationController
include IdvSession

before_action :confirm_two_factor_authenticated
before_action :confirm_idv_attempts_allowed
before_action :confirm_idv_needed
before_action :confirm_step_needed, only: %i[new create]
before_action :set_jurisdiction_form, except: [:failure]

def new
analytics.track_event(Analytics::IDV_JURISDICTION_VISIT)
end

def create
result = @jurisdiction_form.submit(jurisdiction_params)
analytics.track_event(Analytics::IDV_JURISDICTION_FORM, result.to_h)
idv_session.selected_jurisdiction = @jurisdiction_form.state

if result.success?
redirect_to idv_session_url
elsif ial2_consent_missing?
handle_missing_ial2_consent
else
# The only invalid result here is due to an unsupported jurisdiction
# and if it is missing from the params, it will be stopped by
# `strong_params`.
redirect_to failure_url(:unsupported_jurisdiction)
end
end

def failure
presenter = Idv::JurisdictionFailurePresenter.new(
Expand All @@ -37,36 +13,5 @@ def failure
)
render_full_width('shared/_failure', locals: { presenter: presenter })
end

def jurisdiction_params
params.require(:jurisdiction).permit(*Idv::JurisdictionForm::ATTRIBUTES)
end

private

def set_jurisdiction_form
@jurisdiction_form ||= Idv::JurisdictionForm.new
end

def confirm_step_needed
selected_jurisdiction = idv_session.selected_jurisdiction
return unless Idv::FormJurisdictionValidator::SUPPORTED_JURISDICTIONS.
include? selected_jurisdiction

redirect_to idv_session_url unless selected_jurisdiction.nil?
end

def ial2_consent_missing?
!@jurisdiction_form.ial2_consent_given?
end

def handle_missing_ial2_consent
idv_session.selected_jurisdiction = nil
render :new
end

def failure_url(reason)
idv_jurisdiction_failure_url(reason)
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/idv/review_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ReviewController < ApplicationController
before_action :confirm_current_password, only: [:create]

def confirm_idv_steps_complete
return redirect_to(idv_session_url) unless idv_profile_complete?
return redirect_to(idv_doc_auth_url) unless idv_profile_complete?
return redirect_to(idv_phone_url) unless idv_address_complete?
end

Expand Down
8 changes: 0 additions & 8 deletions app/controllers/idv/session_errors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ def warning
@remaining_step_attempts = remaining_step_attempts
end

def timeout
@remaining_step_attempts = remaining_step_attempts
end

def jobfail
@remaining_step_attempts = remaining_step_attempts
end

def failure; end

private
Expand Down
88 changes: 2 additions & 86 deletions app/controllers/idv/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,100 +1,16 @@
module Idv
class SessionsController < ApplicationController
include IdvSession
include PersonalKeyConcern

attr_reader :idv_form

before_action :confirm_two_factor_authenticated, except: %i[success]
before_action :confirm_idv_attempts_allowed, except: %i[success destroy]
before_action :confirm_idv_needed, except: %i[destroy]
before_action :confirm_step_needed, except: %i[success destroy]

delegate :attempts_exceeded?, to: :step, prefix: true

def new
analytics.track_event(Analytics::IDV_BASIC_INFO_VISIT)
set_idv_form
@selected_state = idv_session.selected_jurisdiction
end

def create
set_idv_form
form_result = idv_form.submit(profile_params)
analytics.track_event(Analytics::IDV_BASIC_INFO_SUBMITTED_FORM, form_result.to_h)
return process_form_failure unless form_result.success?
submit_proofing_attempt
end
before_action :confirm_two_factor_authenticated

def destroy
analytics.track_event(Analytics::IDV_VERIFICATION_ATTEMPT_CANCELLED)
Idv::CancelVerificationAttempt.new(user: current_user).call
user_session['idv/doc_auth'] = {}
idv_session.clear
user_session.delete(:decrypted_pii)
redirect_to idv_url
end

def success; end

private

def confirm_step_needed
redirect_to idv_session_success_url if idv_session.profile_confirmation == true
end

def step
@_step ||= Idv::ProfileStep.new(idv_session: idv_session)
end

def process_form_failure
if (sp_name = decorated_session.sp_name) && idv_form.unsupported_jurisdiction?
idv_form.add_sp_unsupported_jurisdiction_error(sp_name)
end
render :new
end

def submit_proofing_attempt
idv_result = step.submit(profile_params.to_h)
analytics.track_event(Analytics::IDV_BASIC_INFO_SUBMITTED_VENDOR, idv_result.to_h)
redirect_to idv_session_success_url and return if idv_result.success?
handle_proofing_failure
end

def handle_proofing_failure
idv_session.previous_profile_step_params = profile_params.to_h
redirect_to failure_url(step.failure_reason)
end

def step_name
:sessions
end

def remaining_step_attempts
Throttler::RemainingCount.call(current_user.id, :idv_resolution)
end

def set_idv_form
@idv_form ||= Idv::ProfileForm.new(
user: current_user,
previous_params: idv_session.previous_profile_step_params,
)
end

def profile_params
params.require(:profile).permit(Idv::ProfileForm::PROFILE_ATTRIBUTES)
end

def failure_url(reason)
case reason
when :warning
idv_session_errors_warning_url
when :timeout
idv_session_errors_timeout_url
when :jobfail
idv_session_errors_jobfail_url
when :fail
idv_session_errors_failure_url
end
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/idv/usps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def confirm_user_completed_idv_profile_step
return if current_user.decorate.pending_profile_requires_verification?
return if idv_session.profile_confirmation == true

redirect_to idv_session_url
redirect_to idv_doc_auth_url
end

def resend_letter
Expand Down
13 changes: 2 additions & 11 deletions app/controllers/idv_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ def fail
private

def verify_identity
analytics.track_event(Analytics::IDV_INTRO_VISIT)
if proof_with_cac?
redirect_to idv_cac_url
elsif doc_auth_enabled_and_exclusive?
redirect_to idv_doc_auth_url
else
analytics.track_event(Analytics::IDV_INTRO_VISIT)
redirect_to idv_jurisdiction_url
redirect_to idv_doc_auth_url
end
end

Expand All @@ -54,11 +52,4 @@ def proof_with_cac?
(Db::EmailAddress::HasGovOrMil.call(current_user) ||
current_user.piv_cac_configurations.any?)
end

def doc_auth_enabled_and_exclusive?
# exclusive mode replaces the existing LOA3 flow with the doc auth flow
# non-exclusive mode allows both flows to co-exist
# in non-exclusive mode you enter the /verify/doc_auth path in the browser
FeatureManagement.doc_auth_enabled? && FeatureManagement.doc_auth_exclusive?
end
end
39 changes: 0 additions & 39 deletions app/forms/idv/jurisdiction_form.rb

This file was deleted.

54 changes: 0 additions & 54 deletions app/forms/idv/profile_form.rb

This file was deleted.

2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def sign_up_or_idv_no_js_link
if user_signing_up?
destroy_user_path
elsif user_verifying_identity?
idv_session_path
idv_doc_auth_url
end
end

Expand Down
10 changes: 0 additions & 10 deletions app/helpers/form_helper.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
module FormHelper
def state_id_types
Idv::FormStateIdValidator::STATE_ID_TYPES.map do |state_id_type|
[t("idv.form.state_id_type.#{state_id_type}"), state_id_type]
end
end

# rubocop:disable MethodLength
# rubocop:disable Style/WordArray
# This method is single statement spread across many lines for readability
Expand Down Expand Up @@ -85,10 +79,6 @@ def international_phone_codes
end
end

def supported_jurisdictions
Idv::FormJurisdictionValidator::SUPPORTED_JURISDICTIONS
end

def state_name_for_abbrev(abbrev)
us_states_territories.find([]) { |state| state.second == abbrev }.first
end
Expand Down
5 changes: 0 additions & 5 deletions app/presenters/two_factor_login_options_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ def options
configurations.group_by(&:class).flat_map { |klass, set| klass.selection_presenters(set) }
end

def should_display_account_reset_or_cancel_link?
# IAL2 non-docauth users should not be able to reset account to comply with AAL2 reqs
!current_user.decorate.identity_verified? || FeatureManagement.doc_auth_enabled?
end

def account_reset_or_cancel_link
account_reset_token_valid? ? account_reset_cancel_link : account_reset_link
end
Expand Down
Loading