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
9 changes: 2 additions & 7 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class ApplicationController < ActionController::Base # rubocop:disable Metrics/C
include UserSessionContext
include VerifyProfileConcern
include LocaleHelper
include VerifySPAttributesConcern

FLASH_KEYS = %w[alert error notice success warning].freeze

Expand Down Expand Up @@ -148,7 +149,7 @@ def two_2fa_setup
end

def after_multiple_2fa_sign_up
if user_needs_sign_up_completed_page?
if needs_completions_screen?
sign_up_completed_url
elsif current_user.decorate.password_reset_profile.present?
reactivate_account_url
Expand Down Expand Up @@ -249,12 +250,6 @@ def render_full_width(template, **opts)
render template, **opts, layout: 'base'
end

def user_needs_sign_up_completed_page?
issuer = sp_session[:issuer]
return false unless issuer
!user_has_ial1_identity_for_issuer?(issuer)
end

def user_has_ial1_identity_for_issuer?(issuer)
current_user.identities.where(service_provider: issuer, ial: 1).any?
end
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/concerns/verify_sp_attributes_concern.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
module VerifySPAttributesConcern
def needs_completions_screen?
sp_session[:issuer].present? && (sp_session_identity.nil? || !requested_attributes_verified?)
end

def needs_sp_attribute_verification?
if sp_session_identity.nil? || !requested_attributes_verified?
if needs_completions_screen?
set_verify_shared_attributes_session
true
else
Expand Down
1 change: 0 additions & 1 deletion app/controllers/openid_connect/authorization_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ class AuthorizationController < ApplicationController
include FullyAuthenticatable
include RememberDeviceConcern
include VerifyProfileConcern
include VerifySPAttributesConcern

before_action :build_authorize_form_from_params, only: [:index]
before_action :validate_authorize_form, only: [:index]
Expand Down
1 change: 0 additions & 1 deletion app/controllers/saml_idp_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class SamlIdpController < ApplicationController
include FullyAuthenticatable
include RememberDeviceConcern
include VerifyProfileConcern
include VerifySPAttributesConcern

skip_before_action :verify_authenticity_token
before_action :confirm_user_is_authenticated_with_fresh_mfa, only: :auth
Expand Down
12 changes: 3 additions & 9 deletions app/controllers/sign_up/completions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
module SignUp
class CompletionsController < ApplicationController
include SecureHeadersConcern
include VerifySPAttributesConcern

before_action :confirm_two_factor_authenticated
before_action :verify_confirmed, if: :loa3?
before_action :apply_secure_headers_override, only: :show

def show
@view_model = view_model
if show_completions_page?
if needs_completions_screen?
analytics.track_event(
Analytics::USER_REGISTRATION_AGENCY_HANDOFF_PAGE_VISIT,
analytics_attributes(''),
Expand All @@ -20,7 +19,7 @@ def show
end

def update
track_completion_event('agency-page') if user_needs_sign_up_completed_page?
track_completion_event('agency-page') if needs_completions_screen?
handle_verified_attributes
if decider.go_back_to_mobile_app?
sign_user_out_and_instruct_to_go_back_to_mobile_app
Expand All @@ -36,11 +35,6 @@ def handle_verified_attributes
clear_verify_attributes_sessions
end

def show_completions_page?
service_providers = sp_session[:issuer].present? || @view_model.user_has_identities?
user_fully_authenticated? && service_providers
end

def view_model
SignUpCompletionsShow.new(
loa3_requested: loa3?,
Expand All @@ -59,7 +53,7 @@ def loa3?
end

def return_to_account
track_completion_event('account-page') if user_needs_sign_up_completed_page?
track_completion_event('account-page')
redirect_to account_url
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/sign_up/personal_keys_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def assign_initial_personal_key
end

def next_step
if user_needs_sign_up_completed_page?
if needs_completions_screen?
sign_up_completed_url
elsif current_user.decorate.password_reset_profile.present?
reactivate_account_url
Expand Down
2 changes: 1 addition & 1 deletion app/views/sign_up/completions/_show_identities.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
p.fs-20p
- if identities.length > 1
= t('idv.messages.agencies_login')
- else
- elsif identities.length == 1
= t('idv.messages.agency_login_html', sp: identities.first.display_name)
ul.list-reset
- identities.each do |identity|
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/sign_up/completions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
user = create(:user)
create(:identity, user: user)
stub_sign_in(user)
subject.session[:sp] = {}
subject.session[:sp] = { issuer: 'awesome sp', loa3: false }
get :show

expect(response).to render_template(:show)
Expand Down