summaryrefslogtreecommitdiffstats
path: root/routers/web/repo/http.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-03-22 08:03:22 +0100
committerGitHub <noreply@github.com>2022-03-22 15:03:22 +0800
commit80fd25524e13dedbdc3527b32d008de152213a89 (patch)
tree63b2bfe4ffaf1dce12080cabdc2e845c8731a673 /routers/web/repo/http.go
parent5495ba7660979973ba19e304786135da474e0e64 (diff)
downloadgitea-80fd25524e13dedbdc3527b32d008de152213a89.tar.gz
gitea-80fd25524e13dedbdc3527b32d008de152213a89.zip
Renamed ctx.User to ctx.Doer. (#19161)
Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'routers/web/repo/http.go')
-rw-r--r--routers/web/repo/http.go16
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)