Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4654e9b
changelog: User-Facing Improvements, Face or Touch Unlock Adoption, T…
kevinsmaster5 Jun 3, 2025
859c35a
migrated schema
kevinsmaster5 Jun 3, 2025
b03b514
rename table and method
kevinsmaster5 Jun 3, 2025
5757da8
remove unneeded schema changes. add check for platform auth available…
kevinsmaster5 Jun 4, 2025
d98d80e
add delivery pref for sms, add test for controller changes
kevinsmaster5 Jun 4, 2025
8272b31
clean up unneeded saves
kevinsmaster5 Jun 4, 2025
113031c
move redirect to app controller after sign in path
kevinsmaster5 Jun 4, 2025
63c120e
check for mfa selection flow
kevinsmaster5 Jun 4, 2025
b43bdba
indentation
kevinsmaster5 Jun 5, 2025
934bdce
remove no-longer needed session key deletion
kevinsmaster5 Jun 5, 2025
a1e84f0
only qualify if user is on mobile
kevinsmaster5 Jun 5, 2025
8a7545b
should not be in selection flow, also fix test lint
kevinsmaster5 Jun 5, 2025
ccc95e5
fix test by settinga dismissed at time for the user's webauthn_platfo…
kevinsmaster5 Jun 5, 2025
17a7896
move dismissed_at to users factory
kevinsmaster5 Jun 9, 2025
959ed57
remove removed linebreaks
kevinsmaster5 Jun 9, 2025
a1fcacd
move to :with_phone
kevinsmaster5 Jun 9, 2025
7084715
rely on sms setup value
kevinsmaster5 Jun 9, 2025
a893210
fix check for sms setup
kevinsmaster5 Jun 9, 2025
5667ed6
change dismissed at from db update
kevinsmaster5 Jun 9, 2025
0cec7ce
add dismissal update further downstream of test
kevinsmaster5 Jun 9, 2025
2d13f5f
back out of changes in 0c0be1c
kevinsmaster5 Jun 10, 2025
feb7906
merge funny business removed
kevinsmaster5 Jun 10, 2025
4b9ccf7
further schema unwanted merge flack removed
kevinsmaster5 Jun 10, 2025
037dd75
optimize ordering of checks for upsell eligibility
kevinsmaster5 Jun 10, 2025
6abf765
refactor tests to avoid updating user db values
kevinsmaster5 Jun 10, 2025
a02d3da
replace with click button on 'Skip'
kevinsmaster5 Jun 11, 2025
6d05201
remove unlikely needed button click
kevinsmaster5 Jun 11, 2025
d821f79
add in missing button click
kevinsmaster5 Jun 11, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def create

if UserSessionContext.confirmation_context?(context)
handle_valid_confirmation_otp
elsif confirm_eligible_for_platform_upsell?
redirect_to webauthn_platform_recommended_path
else
redirect_to after_sign_in_path_for(current_user)
end
Expand Down Expand Up @@ -99,6 +101,14 @@ def track_mfa_added
Funnel::Registration::AddMfa.call(current_user.id, 'phone', analytics, threatmetrix_attrs)
end

def confirm_eligible_for_platform_upsell?
user_session[:platform_authenticator_available] &&
!current_user.webauthn_platform_recommended_dismissed_at? &&
phone_configuration.delivery_preference == 'sms' &&
mobile? &&
current_user.webauthn_configurations.where(platform_authenticator: [false, nil])
end

def confirm_multiple_factors_enabled
return if UserSessionContext.confirmation_context?(context)
phone_enabled = phone_enabled?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,36 @@
)
end
end

context 'when recommending if user is eligible for webauthn platform setup' do
context 'when user is recommended for webauthn platform setup' do
it 'redirects to the webauthn platform recommendation' do
allow(subject).to receive(:mobile?).and_return(true)
subject.current_user.update(webauthn_platform_recommended_dismissed_at: nil)
controller.user_session[:platform_authenticator_available] = true
post :create, params: {
code: subject.current_user.reload.direct_otp,
otp_delivery_preference: 'sms',
}

expect(response).to redirect_to webauthn_platform_recommended_path
end
end

context 'when a user is not recommended for webauthn platform setup' do
it 'redirects to the user account' do
allow(subject).to receive(:mobile?).and_return(false)
subject.current_user.update(webauthn_platform_recommended_dismissed_at: Time.zone.now)
controller.user_session[:platform_authenticator_available] = true
post :create, params: {
code: subject.current_user.reload.direct_otp,
otp_delivery_preference: 'sms',
}

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

context 'when the user enters a valid OTP' do
Expand Down
10 changes: 9 additions & 1 deletion spec/features/openid_connect/openid_connect_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@
user: user,
scope: 'openid email profile:verified_at',
handoff_page_steps: proc do
click_button t('webauthn_platform_recommended.skip')
expect(page).to have_content(t('help_text.requested_attributes.verified_at'))

click_agree_and_continue
Expand All @@ -571,6 +572,7 @@
token_response = sign_in_get_token_response(
scope: 'openid email profile:verified_at',
handoff_page_steps: proc do
click_button t('webauthn_platform_recommended.skip')
expect(page).not_to have_content(t('help_text.requested_attributes.verified_at'))

click_agree_and_continue
Expand Down Expand Up @@ -716,6 +718,7 @@
user: user,
client_id: client_id,
handoff_page_steps: proc do
click_button t('webauthn_platform_recommended.skip')
expect(page).to have_content(t('titles.sign_up.completion_consent_expired_ial1'))
expect(page).to_not have_content(t('titles.sign_up.completion_new_sp'))

Expand All @@ -739,6 +742,7 @@
user: user,
client_id: client_id,
handoff_page_steps: proc do
click_button t('webauthn_platform_recommended.skip')
expect(page).to have_content(t('titles.sign_up.completion_new_sp'))
expect(page).to_not have_content(t('titles.sign_up.completion_consent_expired_ial1'))

Expand Down Expand Up @@ -775,6 +779,8 @@
_user = sign_in_live_with_2fa(user)
expect(page.html).to_not include(code_challenge)

click_button t('webauthn_platform_recommended.skip')

redirect_uri = URI(oidc_redirect_url)
redirect_params = Rack::Utils.parse_query(redirect_uri.query).with_indifferent_access

Expand All @@ -799,6 +805,7 @@
it 'returns the most recent nonce when there are multiple authorize calls' do
client_id = 'urn:gov:gsa:openidconnect:test'
user = user_with_2fa

link_identity(user, build(:service_provider, issuer: client_id))
user.identities.last.update!(verified_attributes: ['email'])

Expand Down Expand Up @@ -841,6 +848,8 @@
sign_in_live_with_2fa(user)
continue_as(user.email)

click_button t('webauthn_platform_recommended.skip')

redirect_uri2 = URI(oidc_redirect_url)
expect(redirect_uri2.to_s).to start_with('gov.gsa.openidconnect.test://result')

Expand Down Expand Up @@ -1163,7 +1172,6 @@ def sign_in_get_token_response(

link_identity(user, build(:service_provider, issuer: client_id))
user.identities.last.update!(verified_attributes: ['email'])

visit openid_connect_authorize_path(
client_id: client_id,
response_type: 'code',
Expand Down