1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-12 12:38:20 +00:00

backport "Enforce token on api routes (#4840)" (#4905)

This commit is contained in:
techknowlogick
2018-09-11 10:39:32 -04:00
committed by GitHub
parent d918e63bc5
commit 1a68b3962f
17 changed files with 123 additions and 83 deletions

View File

@@ -132,7 +132,7 @@ func repoAssignment() macaron.Handler {
// Contexter middleware already checks token for user sign in process.
func reqToken() macaron.Handler {
return func(ctx *context.Context) {
if !ctx.IsSigned {
if true != ctx.Data["IsApiToken"] {
ctx.Error(401)
return
}