Commit 0f37721b authored by Patricio Cano's avatar Patricio Cano

2FA check is now done in the main GitHTTPClientController

parent 641d061e
...@@ -29,6 +29,7 @@ class Projects::GitHttpClientController < Projects::ApplicationController ...@@ -29,6 +29,7 @@ class Projects::GitHttpClientController < Projects::ApplicationController
# Not allowed # Not allowed
else else
@user = auth_result.user @user = auth_result.user
check_2fa(auth_result.type)
end end
if ci? || user if ci? || user
...@@ -91,6 +92,12 @@ class Projects::GitHttpClientController < Projects::ApplicationController ...@@ -91,6 +92,12 @@ class Projects::GitHttpClientController < Projects::ApplicationController
[nil, nil] [nil, nil]
end end
def check_2fa(auth_type)
if user && user.two_factor_enabled? && auth_type == :gitlab_or_ldap
render plain: "HTTP Basic: Access denied\nYou have 2FA enabled, please use a personal access token for Git over HTTP\n", status: 401
end
end
def repository def repository
_, suffix = project_id_with_suffix _, suffix = project_id_with_suffix
if suffix == '.wiki.git' if suffix == '.wiki.git'
......
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