Commit 34b6d109 authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch 'dblessing_bypass_2fa_setup_help' into 'master'

Skip two factor setup for help pages

See merge request gitlab-org/gitlab!54739
parents 83ffd1c3 168df138
......@@ -2,6 +2,7 @@
class HelpController < ApplicationController
skip_before_action :authenticate_user!, unless: :public_visibility_restricted?
skip_before_action :check_two_factor_requirement
feature_category :not_owned
layout 'help'
......
---
title: Skip two factor setup for help pages
merge_request: 54739
author:
type: fixed
......@@ -132,6 +132,18 @@ RSpec.describe HelpController do
expect(response).to redirect_to(new_user_session_path)
end
end
context 'when two factor is required' do
before do
stub_two_factor_required
end
it 'does not redirect to two factor auth' do
get :index
expect(response).not_to redirect_to(profile_two_factor_auth_path)
end
end
end
describe 'GET #show' do
......@@ -152,6 +164,16 @@ RSpec.describe HelpController do
end
it_behaves_like 'documentation pages local render'
context 'when two factor is required' do
before do
stub_two_factor_required
end
it 'does not redirect to two factor auth' do
expect(response).not_to redirect_to(profile_two_factor_auth_path)
end
end
end
context 'when a custom help_page_documentation_url is set in database' do
......@@ -254,4 +276,9 @@ RSpec.describe HelpController do
def stub_readme(content)
expect_file_read(Rails.root.join('doc', 'README.md'), content: content)
end
def stub_two_factor_required
allow(controller).to receive(:two_factor_authentication_required?).and_return(true)
allow(controller).to receive(:current_user_requires_two_factor?).and_return(true)
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