Commit 16f27135 authored by Eduardo Sanz García's avatar Eduardo Sanz García

Move two-factor authentication callout to the todo-list page

Before this change, we display a callout for users that have enabled the
two-factor authentication but have not yet download the recovery codes.
This callout was displayed in all pages.

After this change, the callout is only displayed in the `To-Do List`
page.

Changelog: changed
parent c90a89ef
......@@ -2,6 +2,7 @@
- page_title _("To-Do List")
- header_title _("To-Do List"), dashboard_todos_path
= render_two_factor_auth_recovery_settings_check
= render_dashboard_ultimate_trial(current_user)
- add_page_specific_style 'page_bundles/todos'
......
......@@ -14,7 +14,6 @@
= dispensable_render "layouts/nav/classification_level_banner"
= yield :flash_message
= dispensable_render "shared/service_ping_consent"
= render_two_factor_auth_recovery_settings_check
= dispensable_render_if_exists "layouts/header/ee_subscribable_banner"
= dispensable_render_if_exists "layouts/header/seats_count_alert"
= dispensable_render_if_exists "shared/namespace_storage_limit_alert"
......
= render 'shared/global_alert',
variant: :warning,
alert_class: 'js-recovery-settings-callout',
alert_class: 'js-recovery-settings-callout gl-mt-5',
alert_data: { feature_id: Users::CalloutsHelper::TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK, dismiss_endpoint: callouts_path, defer_links: 'true' },
close_button_data: { testid: 'close-account-recovery-regular-check-callout' } do
.gl-alert-body
......
......@@ -19,7 +19,7 @@ RSpec.describe 'Account recovery regular check callout' do
end
it 'does not show the callout' do
visit root_dashboard_path
visit dashboard_todos_path
expect(page).not_to have_content(message)
end
......@@ -32,12 +32,11 @@ RSpec.describe 'Account recovery regular check callout' do
fill_in 'current_password', with: user_two_factor_disabled.password
click_button 'Register with two-factor app'
expect(page).not_to have_content(message)
click_button 'Copy codes'
click_link 'Proceed'
visit dashboard_todos_path
expect(page).not_to have_content(message)
end
end
......@@ -49,14 +48,14 @@ RSpec.describe 'Account recovery regular check callout' do
end
it 'shows callout if not dismissed' do
visit root_dashboard_path
visit dashboard_todos_path
expect(page).to have_content(message)
expect(page).to have_link(action_button, href: profile_two_factor_auth_path)
end
it 'hides callout when user clicks action button', :js do
visit root_dashboard_path
visit dashboard_todos_path
expect(page).to have_content(message)
......@@ -67,7 +66,7 @@ RSpec.describe 'Account recovery regular check callout' do
end
it 'hides callout when user clicks close', :js do
visit root_dashboard_path
visit dashboard_todos_path
expect(page).to have_content(message)
......@@ -77,25 +76,25 @@ RSpec.describe 'Account recovery regular check callout' do
end
it 'shows callout on next session if user did not dismissed it' do
visit root_dashboard_path
visit dashboard_todos_path
expect(page).to have_content(message)
start_new_session(user_two_factor_enabled)
visit root_dashboard_path
visit dashboard_todos_path
expect(page).to have_content(message)
end
it 'hides callout on next session if user dismissed it', :js do
visit root_dashboard_path
visit dashboard_todos_path
expect(page).to have_content(message)
close_callout
start_new_session(user_two_factor_enabled)
visit root_dashboard_path
visit dashboard_todos_path
expect(page).not_to have_content(message)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment