diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-11 15:09:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-11 15:09:43 +0300 |
commit | 54f170b69972d46a5bab2a0231510a41e610da31 (patch) | |
tree | 6943aba13e4bdf28045136d0c1a1f26c4d3fb94f /app/controllers/repositories | |
parent | 8c59925bbbc05315565cd9eb54c897be69072d65 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/repositories')
-rw-r--r-- | app/controllers/repositories/git_http_client_controller.rb | 17 | ||||
-rw-r--r-- | app/controllers/repositories/lfs_api_controller.rb | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/app/controllers/repositories/git_http_client_controller.rb b/app/controllers/repositories/git_http_client_controller.rb index a5b81054ee4..55c35a5e8b5 100644 --- a/app/controllers/repositories/git_http_client_controller.rb +++ b/app/controllers/repositories/git_http_client_controller.rb @@ -60,8 +60,10 @@ module Repositories send_challenges render plain: "HTTP Basic: Access denied\n", status: :unauthorized - rescue Gitlab::Auth::MissingPersonalAccessTokenError + rescue Gitlab::Auth::Missing2FAError render_missing_personal_access_token + rescue Gitlab::Auth::InvalidOTPError + render_invalid_otp end def basic_auth_provided? @@ -97,9 +99,16 @@ module Repositories def render_missing_personal_access_token render plain: "HTTP Basic: Access denied\n" \ - "You must use a personal access token with 'read_repository' or 'write_repository' scope for Git over HTTP.\n" \ - "You can generate one at #{profile_personal_access_tokens_url}", - status: :unauthorized + "You must append your OTP code after your password (no spaces)\n" \ + "or use a personal access token (PAT) with a 'read_repository' or 'write_repository' scope for Git over HTTP.\n" \ + "You can generate a PAT at #{profile_personal_access_tokens_url}", + status: :unauthorized + end + + def render_invalid_otp + render plain: "HTTP Basic: Access denied\n" \ + "Invalid OTP provided", + status: :unauthorized end def repository diff --git a/app/controllers/repositories/lfs_api_controller.rb b/app/controllers/repositories/lfs_api_controller.rb index ab846966792..248323a0bb5 100644 --- a/app/controllers/repositories/lfs_api_controller.rb +++ b/app/controllers/repositories/lfs_api_controller.rb @@ -105,7 +105,7 @@ module Repositories 'Content-Type': LFS_TRANSFER_CONTENT_TYPE } - if Feature.enabled?(:lfs_chunked_encoding, project) + if Feature.enabled?(:lfs_chunked_encoding, project, default_enabled: true) headers['Transfer-Encoding'] = 'chunked' end |