summaryrefslogtreecommitdiffstats
path: root/routers/api/v1
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1')
-rw-r--r--routers/api/v1/api.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 8418ab94a1..ac92f7cd43 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -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()
}
}