idk even know anymore

i think i added games
This commit is contained in:
2026-02-15 21:48:01 +03:00
parent 7ced62517a
commit c357e78003
18 changed files with 568 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
package auth
import (
"fmt"
"net/http"
"time"
)
@@ -28,3 +29,17 @@ func RemoveUserCookie(w http.ResponseWriter) {
SameSite: http.SameSiteStrictMode,
})
}
func GetUserIdFromRequest(r *http.Request) (int64, error) {
c, err := r.Cookie("token")
if err != nil {
return -1, fmt.Errorf("no token cookie: %v", err)
}
userId, err := ValidateUserToken(c.Value)
if err != nil {
return -1, fmt.Errorf("invalid token: %v", err)
}
return userId, nil
}