|
|
@ -14,7 +14,6 @@ import ( |
|
|
|
"path/filepath" |
|
|
|
"path/filepath" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/context" |
|
|
|
"code.gitea.io/gitea/modules/context" |
|
|
|
"code.gitea.io/gitea/modules/httpcache" |
|
|
|
"code.gitea.io/gitea/modules/httpcache" |
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
@ -147,15 +146,7 @@ func Recovery() func(next http.Handler) http.Handler { |
|
|
|
"i18n": lc, |
|
|
|
"i18n": lc, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var user *models.User |
|
|
|
var user = context.GetContextUser(req) |
|
|
|
if apiContext := context.GetAPIContext(req); apiContext != nil { |
|
|
|
|
|
|
|
user = apiContext.User |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if user == nil { |
|
|
|
|
|
|
|
if ctx := context.GetContext(req); ctx != nil { |
|
|
|
|
|
|
|
user = ctx.User |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if user == nil { |
|
|
|
if user == nil { |
|
|
|
// Get user from session if logged in - do not attempt to sign-in
|
|
|
|
// Get user from session if logged in - do not attempt to sign-in
|
|
|
|
user = auth.SessionUser(sessionStore) |
|
|
|
user = auth.SessionUser(sessionStore) |
|
|
|