Commit d404341e authored by Phil Hughes's avatar Phil Hughes

Merge branch '290113-feature-flag-rollout-of-vue_2fa_recovery_codes' into 'master'

Remove `vue_2fa_recovery_codes` feature flag

See merge request gitlab-org/gitlab!51407
parents 3349f7e4 55fabba2
- show_success_alert = local_assigns.fetch(:show_success_alert, nil)
- if Feature.enabled?(:vue_2fa_recovery_codes, current_user, default_enabled: true)
.js-2fa-recovery-codes{ data: { codes: @codes.to_json, profile_account_path: profile_account_path(two_factor_auth_enabled_successfully: show_success_alert) } }
- else
%p.slead
- lose_2fa_message = _('Should you ever lose your phone or access to your one time password secret, each of these recovery codes can be used one time each to regain access to your account. Please save them in a safe place, or you %{b_start}will%{b_end} lose access to your account.') % { b_start:'<b>', b_end:'</b>' }
= lose_2fa_message.html_safe
.codes.card{ data: { qa_selector: 'codes_content' } }
%ul
- @codes.each do |code|
%li
%span.monospace{ data: { qa_selector: 'code_content' } }= code
.d-flex
= link_to _('Proceed'), profile_account_path, class: 'gl-button btn btn-success gl-mr-3', data: { qa_selector: 'proceed_button' }
= link_to _('Download codes'), "data:text/plain;charset=utf-8,#{CGI.escape(@codes.join("\n"))}", download: "gitlab-recovery-codes.txt", class: 'gl-button btn btn-default'
.js-2fa-recovery-codes{ data: { codes: @codes.to_json, profile_account_path: profile_account_path(two_factor_auth_enabled_successfully: show_success_alert) } }
- page_title _('Two-factor Authentication'), _('Account')
- add_page_specific_style 'page_bundles/profile_two_factor_auth'
- unless Feature.enabled?(:vue_2fa_recovery_codes, current_user, default_enabled: true)
.gl-alert.gl-alert-success.gl-mb-5
= _('Congratulations! You have enabled Two-factor Authentication!')
= render 'codes', show_success_alert: true
---
name: vue_2fa_recovery_codes
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49078
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/290113
milestone: '13.7'
type: development
group: group::access
default_enabled: true
......@@ -25854,9 +25854,6 @@ msgstr ""
msgid "Sherlock Transactions"
msgstr ""
msgid "Should you ever lose your phone or access to your one time password secret, each of these recovery codes can be used one time each to regain access to your account. Please save them in a safe place, or you %{b_start}will%{b_end} lose access to your account."
msgstr ""
msgid "Should you ever lose your phone or access to your one time password secret, each of these recovery codes can be used one time each to regain access to your account. Please save them in a safe place, or you %{boldStart}will%{boldEnd} lose access to your account."
msgstr ""
......
......@@ -742,65 +742,30 @@ RSpec.describe 'Login' do
end
context 'when the user did not enable 2FA' do
context 'when `vue_2fa_recovery_codes` feature flag is disabled' do
before do
stub_feature_flags(vue_2fa_recovery_codes: false)
end
it 'asks to set 2FA before asking to accept the terms' do
expect(authentication_metrics)
.to increment(:user_authenticated_counter)
visit new_user_session_path
fill_in 'user_login', with: user.email
fill_in 'user_password', with: '12345678'
click_button 'Sign in'
expect_to_be_on_terms_page
click_button 'Accept terms'
expect(current_path).to eq(profile_two_factor_auth_path)
fill_in 'pin_code', with: user.reload.current_otp
click_button 'Register with two-factor app'
expect(page).to have_content('Congratulations! You have enabled Two-factor Authentication!')
click_link 'Proceed'
expect(current_path).to eq(profile_account_path)
end
end
context 'when `vue_2fa_recovery_codes` feature flag is enabled' do
it 'asks to set 2FA before asking to accept the terms', :js do
expect(authentication_metrics)
.to increment(:user_authenticated_counter)
it 'asks to set 2FA before asking to accept the terms', :js do
expect(authentication_metrics)
.to increment(:user_authenticated_counter)
visit new_user_session_path
visit new_user_session_path
fill_in 'user_login', with: user.email
fill_in 'user_password', with: '12345678'
fill_in 'user_login', with: user.email
fill_in 'user_password', with: '12345678'
click_button 'Sign in'
click_button 'Sign in'
expect_to_be_on_terms_page
click_button 'Accept terms'
expect_to_be_on_terms_page
click_button 'Accept terms'
expect(current_path).to eq(profile_two_factor_auth_path)
expect(current_path).to eq(profile_two_factor_auth_path)
fill_in 'pin_code', with: user.reload.current_otp
fill_in 'pin_code', with: user.reload.current_otp
click_button 'Register with two-factor app'
click_button 'Copy codes'
click_link 'Proceed'
click_button 'Register with two-factor app'
click_button 'Copy codes'
click_link 'Proceed'
expect(current_path).to eq(profile_account_path)
expect(page).to have_content('Congratulations! You have enabled Two-factor Authentication!')
end
expect(current_path).to eq(profile_account_path)
expect(page).to have_content('Congratulations! You have enabled Two-factor Authentication!')
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