Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed May 18, 2023
1 parent 342c480 commit a578e3a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions services/auth/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ func Auth(authMethod Method) func(*context.Context) {
ctx.Error(http.StatusUnauthorized, "Verify")
return
}
ctx.Doer = ar.Doer
ctx.IsSigned = ar.Doer != nil
ctx.IsBasicAuth = ar.IsBasicAuth
if ctx.Doer == nil {
// ensure the session uid is deleted
_ = ctx.Session.Delete("uid")
}
ctx.Doer = ar.Doer
ctx.IsSigned = ar.Doer != nil
ctx.IsBasicAuth = ar.IsBasicAuth
}
}

Expand All @@ -41,6 +41,7 @@ func APIAuth(authMethod Method) func(*context.APIContext) {
if err != nil {
ctx.Error(http.StatusUnauthorized, "APIAuth", err)
}
ctx.Doer = ar.Doer
ctx.IsSigned = ar.Doer != nil
ctx.IsBasicAuth = ar.IsBasicAuth
}
Expand Down Expand Up @@ -80,7 +81,7 @@ type VerifyOptions struct {
DisableCSRF bool
}

// Checks authentication according to options
// VerifyAuthWithOptions checks authentication according to options
func VerifyAuthWithOptions(options *VerifyOptions) func(ctx *context.Context) {
return func(ctx *context.Context) {
// Check prohibit login users.
Expand Down

0 comments on commit a578e3a

Please sign in to comment.