Skip to content

Commit

Permalink
Restore token authentication for git http when 2FA active (#15915)
Browse files Browse the repository at this point in the history
There was a small regression in #15303 whereby token auth
with 2FA active would be disallowed.

This PR fixes this.

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: 6543 <[email protected]>
  • Loading branch information
zeripath and 6543 authored May 19, 2021
1 parent 825547b commit 0e56e9c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion routers/repo/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func httpBase(ctx *context.Context) (h *serviceHandler) {
return
}

if ctx.IsBasicAuth {
if ctx.IsBasicAuth && ctx.Data["IsApiToken"] != true {
_, err = models.GetTwoFactorByUID(ctx.User.ID)
if err == nil {
// TODO: This response should be changed to "invalid credentials" for security reasons once the expectation behind it (creating an app token to authenticate) is properly documented
Expand Down

0 comments on commit 0e56e9c

Please sign in to comment.