mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-05 16:56:22 +00:00
⚡️ feat: update global styles and color variables for improved theming
refactor: change import paths for DeviceContext and GravatarAvatar components fix: adjust login form API call and update UI text for clarity feat: add post API for listing posts with pagination and filtering options feat: implement BlogCard component for displaying blog posts with enhanced UI feat: create Badge component for consistent styling of labels and indicators refactor: reintroduce DeviceContext with improved functionality for theme and language management feat: define Label and Post models for better type safety and structure
This commit is contained in:
@ -20,7 +20,7 @@ func UseAuth(block bool) app.HandlerFunc {
|
||||
// 尝试用普通 token 认证
|
||||
tokenClaims, err := utils.Jwt.ParseJsonWebTokenWithoutState(token)
|
||||
if err == nil && tokenClaims != nil {
|
||||
ctx = context.WithValue(ctx, "user_id", tokenClaims.UserID)
|
||||
ctx = context.WithValue(ctx, constant.ContextKeyUserID, tokenClaims.UserID)
|
||||
c.Next(ctx)
|
||||
return
|
||||
}
|
||||
@ -30,8 +30,7 @@ func UseAuth(block bool) app.HandlerFunc {
|
||||
if err == nil && refreshTokenClaims != nil {
|
||||
ok, err := isStatefulJwtValid(refreshTokenClaims)
|
||||
if err == nil && ok {
|
||||
ctx = context.WithValue(ctx, "user_id", refreshTokenClaims.UserID)
|
||||
|
||||
ctx = context.WithValue(ctx, constant.ContextKeyUserID, refreshTokenClaims.UserID)
|
||||
// 生成新 token
|
||||
newTokenClaims := utils.Jwt.NewClaims(
|
||||
refreshTokenClaims.UserID,
|
||||
|
Reference in New Issue
Block a user