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 @@ ...@@ -2,6 +2,7 @@
- page_title _("To-Do List") - page_title _("To-Do List")
- header_title _("To-Do List"), dashboard_todos_path - header_title _("To-Do List"), dashboard_todos_path
= render_two_factor_auth_recovery_settings_check
= render_dashboard_ultimate_trial(current_user) = render_dashboard_ultimate_trial(current_user)
- add_page_specific_style 'page_bundles/todos' - add_page_specific_style 'page_bundles/todos'
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
= dispensable_render "layouts/nav/classification_level_banner" = dispensable_render "layouts/nav/classification_level_banner"
= yield :flash_message = yield :flash_message
= dispensable_render "shared/service_ping_consent" = 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/ee_subscribable_banner"
= dispensable_render_if_exists "layouts/header/seats_count_alert" = dispensable_render_if_exists "layouts/header/seats_count_alert"
= dispensable_render_if_exists "shared/namespace_storage_limit_alert" = dispensable_render_if_exists "shared/namespace_storage_limit_alert"
......
= render 'shared/global_alert', = render 'shared/global_alert',
variant: :warning, 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' }, 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 close_button_data: { testid: 'close-account-recovery-regular-check-callout' } do
.gl-alert-body .gl-alert-body
......
...@@ -19,7 +19,7 @@ RSpec.describe 'Account recovery regular check callout' do ...@@ -19,7 +19,7 @@ RSpec.describe 'Account recovery regular check callout' do
end end
it 'does not show the callout' do it 'does not show the callout' do
visit root_dashboard_path visit dashboard_todos_path
expect(page).not_to have_content(message) expect(page).not_to have_content(message)
end end
...@@ -32,12 +32,11 @@ RSpec.describe 'Account recovery regular check callout' do ...@@ -32,12 +32,11 @@ RSpec.describe 'Account recovery regular check callout' do
fill_in 'current_password', with: user_two_factor_disabled.password fill_in 'current_password', with: user_two_factor_disabled.password
click_button 'Register with two-factor app' click_button 'Register with two-factor app'
expect(page).not_to have_content(message)
click_button 'Copy codes' click_button 'Copy codes'
click_link 'Proceed' click_link 'Proceed'
visit dashboard_todos_path
expect(page).not_to have_content(message) expect(page).not_to have_content(message)
end end
end end
...@@ -49,14 +48,14 @@ RSpec.describe 'Account recovery regular check callout' do ...@@ -49,14 +48,14 @@ RSpec.describe 'Account recovery regular check callout' do
end end
it 'shows callout if not dismissed' do 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_content(message)
expect(page).to have_link(action_button, href: profile_two_factor_auth_path) expect(page).to have_link(action_button, href: profile_two_factor_auth_path)
end end
it 'hides callout when user clicks action button', :js do it 'hides callout when user clicks action button', :js do
visit root_dashboard_path visit dashboard_todos_path
expect(page).to have_content(message) expect(page).to have_content(message)
...@@ -67,7 +66,7 @@ RSpec.describe 'Account recovery regular check callout' do ...@@ -67,7 +66,7 @@ RSpec.describe 'Account recovery regular check callout' do
end end
it 'hides callout when user clicks close', :js do it 'hides callout when user clicks close', :js do
visit root_dashboard_path visit dashboard_todos_path
expect(page).to have_content(message) expect(page).to have_content(message)
...@@ -77,25 +76,25 @@ RSpec.describe 'Account recovery regular check callout' do ...@@ -77,25 +76,25 @@ RSpec.describe 'Account recovery regular check callout' do
end end
it 'shows callout on next session if user did not dismissed it' do 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) expect(page).to have_content(message)
start_new_session(user_two_factor_enabled) start_new_session(user_two_factor_enabled)
visit root_dashboard_path visit dashboard_todos_path
expect(page).to have_content(message) expect(page).to have_content(message)
end end
it 'hides callout on next session if user dismissed it', :js do 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) expect(page).to have_content(message)
close_callout close_callout
start_new_session(user_two_factor_enabled) start_new_session(user_two_factor_enabled)
visit root_dashboard_path visit dashboard_todos_path
expect(page).not_to have_content(message) expect(page).not_to have_content(message)
end 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