mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
committed by
Lunny Xiao
parent
0acaa6bd00
commit
ba12463175
@ -172,6 +172,10 @@ func reqToken() macaron.Handler {
|
||||
if true == ctx.Data["IsApiToken"] {
|
||||
return
|
||||
}
|
||||
if ctx.Context.IsBasicAuth {
|
||||
ctx.CheckForOTP()
|
||||
return
|
||||
}
|
||||
if ctx.IsSigned {
|
||||
ctx.RequireCSRF()
|
||||
return
|
||||
@ -181,11 +185,12 @@ func reqToken() macaron.Handler {
|
||||
}
|
||||
|
||||
func reqBasicAuth() macaron.Handler {
|
||||
return func(ctx *context.Context) {
|
||||
if !ctx.IsBasicAuth {
|
||||
ctx.Error(401)
|
||||
return func(ctx *context.APIContext) {
|
||||
if !ctx.Context.IsBasicAuth {
|
||||
ctx.Context.Error(401)
|
||||
return
|
||||
}
|
||||
ctx.CheckForOTP()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user