fix: lint errors
This commit was merged in pull request #130.
This commit is contained in:
@@ -16,7 +16,6 @@ var UserKey ContextKey = "user"
|
||||
func Authenticate(service service.Auth) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
sessionId := getSessionID(r)
|
||||
session, user, _ := service.SignInSession(sessionId)
|
||||
|
||||
@@ -49,7 +48,12 @@ func GetUser(r *http.Request) *types.User {
|
||||
return nil
|
||||
}
|
||||
|
||||
return obj.(*types.User)
|
||||
user, ok := obj.(*types.User)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
return user
|
||||
}
|
||||
|
||||
func GetSession(r *http.Request) *types.Session {
|
||||
@@ -58,7 +62,12 @@ func GetSession(r *http.Request) *types.Session {
|
||||
return nil
|
||||
}
|
||||
|
||||
return obj.(*types.Session)
|
||||
session, ok := obj.(*types.Session)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
return session
|
||||
}
|
||||
|
||||
func getSessionID(r *http.Request) string {
|
||||
|
||||
Reference in New Issue
Block a user