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

@@ -63,6 +63,7 @@ func SignedInID(ctx *macaron.Context, sess session.Store) int64 {
if err = models.UpdateAccessToken(t); err != nil {
log.Error(4, "UpdateAccessToken: %v", err)
}
ctx.Data["IsApiToken"] = true
return t.UID
}
}
@@ -136,7 +137,7 @@ func SignedInUser(ctx *macaron.Context, sess session.Store) (*models.User, bool)
}
return nil, false
}
ctx.Data["IsApiToken"] = true
return u, true
}
}