Skip to content

Commit a578e3a

Browse files
committed
fix
1 parent 342c480 commit a578e3a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

services/auth/middleware.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ func Auth(authMethod Method) func(*context.Context) {
2424
ctx.Error(http.StatusUnauthorized, "Verify")
2525
return
2626
}
27+
ctx.Doer = ar.Doer
28+
ctx.IsSigned = ar.Doer != nil
29+
ctx.IsBasicAuth = ar.IsBasicAuth
2730
if ctx.Doer == nil {
2831
// ensure the session uid is deleted
2932
_ = ctx.Session.Delete("uid")
3033
}
31-
ctx.Doer = ar.Doer
32-
ctx.IsSigned = ar.Doer != nil
33-
ctx.IsBasicAuth = ar.IsBasicAuth
3434
}
3535
}
3636

@@ -41,6 +41,7 @@ func APIAuth(authMethod Method) func(*context.APIContext) {
4141
if err != nil {
4242
ctx.Error(http.StatusUnauthorized, "APIAuth", err)
4343
}
44+
ctx.Doer = ar.Doer
4445
ctx.IsSigned = ar.Doer != nil
4546
ctx.IsBasicAuth = ar.IsBasicAuth
4647
}
@@ -80,7 +81,7 @@ type VerifyOptions struct {
8081
DisableCSRF bool
8182
}
8283

83-
// Checks authentication according to options
84+
// VerifyAuthWithOptions checks authentication according to options
8485
func VerifyAuthWithOptions(options *VerifyOptions) func(ctx *context.Context) {
8586
return func(ctx *context.Context) {
8687
// Check prohibit login users.

0 commit comments

Comments
 (0)