fix: authenticator crashing when session token invalid

This commit is contained in:
Fritz Heiden 2025-03-13 20:50:11 +01:00
parent ca5b14fc13
commit da0e33fb1b

View File

@ -42,7 +42,7 @@ func (r *Authenticator) Authenticate(path string, exceptions []string) func(next
return err return err
} }
session, error := r.userManager.GetSession(cookie.Value) session, error := r.userManager.GetSession(cookie.Value)
if error != nil { if error != nil || session == nil {
SendError(401, context, fmt.Sprintf("session not found: %s", cookie.Value)) SendError(401, context, fmt.Sprintf("session not found: %s", cookie.Value))
return fmt.Errorf("session not found: %s", cookie.Value) return fmt.Errorf("session not found: %s", cookie.Value)
} }