From de8f9fa2dcb4ad8fa3006a2fe8b1043f2a780628 Mon Sep 17 00:00:00 2001 From: RockChinQ <1010553892@qq.com> Date: Sat, 11 May 2024 14:33:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20cookies=E8=BF=87=E6=9C=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=92=8Cjwt=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/controller/accapi.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/controller/accapi.go b/backend/controller/accapi.go index ce45deb..efd3f92 100644 --- a/backend/controller/accapi.go +++ b/backend/controller/accapi.go @@ -5,6 +5,7 @@ import ( "github.com/RockChinQ/Campux/backend/service" "github.com/gin-gonic/gin" + "github.com/spf13/viper" ) type AccountRouter struct { @@ -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模式 @@ -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"), }) }