From 44078f3be2aa7a8475c5d2efc66d6684bd7f2978 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 26 May 2023 09:26:12 -0400 Subject: [PATCH 1/2] LG-9860: Fix platform authenticator reauthentication redirect changelog: Upcoming Features, Platform Authenticator, Fix redirect for reauthentication during platform authenticator setup --- app/views/users/webauthn_setup/new.html.erb | 2 +- spec/features/webauthn/management_spec.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/users/webauthn_setup/new.html.erb b/app/views/users/webauthn_setup/new.html.erb index b1e78fd3c74..2baa6aefb9a 100644 --- a/app/views/users/webauthn_setup/new.html.erb +++ b/app/views/users/webauthn_setup/new.html.erb @@ -14,7 +14,7 @@ <%= simple_form_for( '', - url: webauthn_setup_path, + url: webauthn_setup_path(platform: @platform_authenticator), method: :patch, html: { class: 'margin-top-4 margin-bottom-1', diff --git a/spec/features/webauthn/management_spec.rb b/spec/features/webauthn/management_spec.rb index 7436e257b1a..6b4fb55e552 100644 --- a/spec/features/webauthn/management_spec.rb +++ b/spec/features/webauthn/management_spec.rb @@ -169,6 +169,17 @@ def expect_webauthn_platform_setup_error expect(page).to have_current_path webauthn_setup_path(platform: true) + # Regression: LG-9860: Ensure that the platform URL parameter is maintained through reauthn + travel_to (IdentityConfig.store.reauthn_window + 1).seconds.from_now + fill_in_nickname_and_click_continue + mock_press_button_on_hardware_key_on_setup + + expect(page).to have_current_path login_two_factor_options_path(reauthn: true) + click_on t('forms.buttons.continue') + fill_in_code_with_last_phone_otp + click_submit_default + + expect(page).to have_current_path webauthn_setup_path(platform: true) fill_in_nickname_and_click_continue mock_press_button_on_hardware_key_on_setup From cd97484f26c7e7edb4947e91047e8276be281e1d Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 26 May 2023 10:35:28 -0400 Subject: [PATCH 2/2] Omit platform parameter if false --- app/views/users/webauthn_setup/new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/webauthn_setup/new.html.erb b/app/views/users/webauthn_setup/new.html.erb index 2baa6aefb9a..716ca4a870b 100644 --- a/app/views/users/webauthn_setup/new.html.erb +++ b/app/views/users/webauthn_setup/new.html.erb @@ -14,7 +14,7 @@ <%= simple_form_for( '', - url: webauthn_setup_path(platform: @platform_authenticator), + url: webauthn_setup_path(platform: @platform_authenticator.presence), method: :patch, html: { class: 'margin-top-4 margin-bottom-1',