Fix: on login add player once
This commit is contained in:
@ -61,8 +61,6 @@ func GetSession(next http.Handler) http.Handler {
|
||||
return
|
||||
}
|
||||
userSession, err := repo.SessionByToken(r.Context(), sessionToken)
|
||||
// userSession, err := cacheGetSession(sessionToken)
|
||||
// log.Debug("userSession from cache", "us", userSession)
|
||||
if err != nil {
|
||||
msg := "auth failed; session does not exists"
|
||||
log.Debug(msg, "error", err, "key", sessionToken)
|
||||
@ -83,13 +81,6 @@ func GetSession(next http.Handler) http.Handler {
|
||||
models.CtxUsernameKey, userSession.Username)
|
||||
ctx = context.WithValue(ctx,
|
||||
models.CtxSessionKey, userSession)
|
||||
// if err := cacheSetSession(sessionToken,
|
||||
// userSession); err != nil {
|
||||
// msg := "failed to marshal user session"
|
||||
// log.Warn(msg, "error", err)
|
||||
// next.ServeHTTP(w, r)
|
||||
// return
|
||||
// }
|
||||
next.ServeHTTP(w, r.WithContext(ctx))
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user