From de8e3948a5e38f7eaf82d3c0cfd10e995bf68e92 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 2 Jan 2022 21:12:35 +0800 Subject: Refactor auth package (#17962) --- routers/web/repo/http.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'routers/web/repo/http.go') diff --git a/routers/web/repo/http.go b/routers/web/repo/http.go index 64e617dc4a..6ebf6a789a 100644 --- a/routers/web/repo/http.go +++ b/routers/web/repo/http.go @@ -20,8 +20,8 @@ import ( "time" "code.gitea.io/gitea/models" + "code.gitea.io/gitea/models/auth" "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/login" "code.gitea.io/gitea/models/perm" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unit" @@ -179,12 +179,12 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { } if ctx.IsBasicAuth && ctx.Data["IsApiToken"] != true { - _, err = login.GetTwoFactorByUID(ctx.User.ID) + _, err = auth.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 ctx.PlainText(http.StatusUnauthorized, "Users with two-factor authentication enabled cannot perform HTTP/HTTPS operations via plain username and password. Please create and use a personal access token on the user settings page") return - } else if !login.IsErrTwoFactorNotEnrolled(err) { + } else if !auth.IsErrTwoFactorNotEnrolled(err) { ctx.ServerError("IsErrTwoFactorNotEnrolled", err) return } -- cgit v1.2.3