Commit 352af3e5 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'sh-fix-github-import-without-oauth2-config' into 'master'

Allow GitHub imports via token even if OAuth2 provider not configured

Closes #38524

See merge request gitlab-org/gitlab-ce!23703
parents 7c4940b7 b4e26794
......@@ -7,7 +7,7 @@ class Import::GithubController < Import::BaseController
rescue_from Octokit::Unauthorized, with: :provider_unauthorized
def new
if logged_in_with_provider?
if github_import_configured? && logged_in_with_provider?
go_to_provider_for_permissions
elsif session[access_token_key]
redirect_to status_import_url
......
---
title: Allow GitHub imports via token even if OAuth2 provider not configured
merge_request: 23703
author:
type: fixed
......@@ -16,6 +16,15 @@ describe Import::GithubController do
get :new
end
it "prompts for an access token if GitHub not configured" do
allow(controller).to receive(:github_import_configured?).and_return(false)
expect(controller).not_to receive(:go_to_provider_for_permissions)
get :new
expect(response).to have_http_status(200)
end
end
describe "GET callback" do
......
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