diff options
Diffstat (limited to 'routers/web/repo/http.go')
-rw-r--r-- | routers/web/repo/http.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/routers/web/repo/http.go b/routers/web/repo/http.go index d5379b610e..989e71a3cf 100644 --- a/routers/web/repo/http.go +++ b/routers/web/repo/http.go @@ -178,7 +178,7 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { } if ctx.IsBasicAuth && ctx.Data["IsApiToken"] != true { - _, err = auth.GetTwoFactorByUID(ctx.User.ID) + _, err = auth.GetTwoFactorByUID(ctx.Doer.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") @@ -189,13 +189,13 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { } } - if !ctx.User.IsActive || ctx.User.ProhibitLogin { + if !ctx.Doer.IsActive || ctx.Doer.ProhibitLogin { ctx.PlainText(http.StatusForbidden, "Your account is disabled.") return } if repoExist { - p, err := models.GetUserRepoPermission(repo, ctx.User) + p, err := models.GetUserRepoPermission(repo, ctx.Doer) if err != nil { ctx.ServerError("GetUserRepoPermission", err) return @@ -220,14 +220,14 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { environ = []string{ models.EnvRepoUsername + "=" + username, models.EnvRepoName + "=" + reponame, - models.EnvPusherName + "=" + ctx.User.Name, - models.EnvPusherID + fmt.Sprintf("=%d", ctx.User.ID), + models.EnvPusherName + "=" + ctx.Doer.Name, + models.EnvPusherID + fmt.Sprintf("=%d", ctx.Doer.ID), models.EnvIsDeployKey + "=false", models.EnvAppURL + "=" + setting.AppURL, } - if !ctx.User.KeepEmailPrivate { - environ = append(environ, models.EnvPusherEmail+"="+ctx.User.Email) + if !ctx.Doer.KeepEmailPrivate { + environ = append(environ, models.EnvPusherEmail+"="+ctx.Doer.Email) } if isWiki { @@ -263,7 +263,7 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { return } - repo, err = repo_service.PushCreateRepo(ctx.User, owner, reponame) + repo, err = repo_service.PushCreateRepo(ctx.Doer, owner, reponame) if err != nil { log.Error("pushCreateRepo: %v", err) ctx.Status(http.StatusNotFound) |