Skip to content

Commit

Permalink
feat: cookies过期时间和jwt同步
Browse files Browse the repository at this point in the history
  • Loading branch information
RockChinQ committed May 11, 2024
1 parent a63874a commit de8f9fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/controller/accapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/RockChinQ/Campux/backend/service"
"github.com/gin-gonic/gin"
"github.com/spf13/viper"
)

type AccountRouter struct {
Expand Down Expand Up @@ -94,7 +95,7 @@ func (ar *AccountRouter) LoginAccount(c *gin.Context) {
Secure: false,
SameSite: http.SameSiteLaxMode,
HttpOnly: false,
MaxAge: 3600,
MaxAge: viper.GetInt("auth.jwt.expire"),
})
} else {
// 正式环境用strict模式
Expand All @@ -106,7 +107,7 @@ func (ar *AccountRouter) LoginAccount(c *gin.Context) {
Secure: false,
SameSite: http.SameSiteStrictMode,
HttpOnly: false,
MaxAge: 3600,
MaxAge: viper.GetInt("auth.jwt.expire"),
})
}

Expand Down

0 comments on commit de8f9fa

Please sign in to comment.