Feat: User/Me

This commit is contained in:
HFO4
2019-11-12 15:34:54 +08:00
parent 80f30465e9
commit 589c399488
9 changed files with 148 additions and 17 deletions

View File

@@ -6,10 +6,13 @@ import (
"github.com/gin-gonic/gin"
)
// Store session存储
var Store memstore.Store
// Session 初始化session
func Session(secret string) gin.HandlerFunc {
store := memstore.NewStore([]byte(secret))
//Also set Secure: true if using SSL, you should though
store.Options(sessions.Options{HttpOnly: true, MaxAge: 7 * 86400, Path: "/"})
return sessions.Sessions("cloudreve-session", store)
Store = memstore.NewStore([]byte(secret))
// Also set Secure: true if using SSL, you should though
Store.Options(sessions.Options{HttpOnly: true, MaxAge: 7 * 86400, Path: "/"})
return sessions.Sessions("cloudreve-session", Store)
}