Unverified Commit 8f119c42 authored by boojack's avatar boojack Committed by GitHub

chore: update session key (#440)

parent 98667028
...@@ -22,7 +22,7 @@ func getUserIDContextKey() string { ...@@ -22,7 +22,7 @@ func getUserIDContextKey() string {
} }
func setUserSession(ctx echo.Context, user *api.User) error { func setUserSession(ctx echo.Context, user *api.User) error {
sess, _ := session.Get("session", ctx) sess, _ := session.Get("memos_session", ctx)
sess.Options = &sessions.Options{ sess.Options = &sessions.Options{
Path: "/", Path: "/",
MaxAge: 3600 * 24 * 30, MaxAge: 3600 * 24 * 30,
...@@ -37,7 +37,7 @@ func setUserSession(ctx echo.Context, user *api.User) error { ...@@ -37,7 +37,7 @@ func setUserSession(ctx echo.Context, user *api.User) error {
} }
func removeUserSession(ctx echo.Context) error { func removeUserSession(ctx echo.Context) error {
sess, _ := session.Get("session", ctx) sess, _ := session.Get("memos_session", ctx)
sess.Options = &sessions.Options{ sess.Options = &sessions.Options{
Path: "/", Path: "/",
MaxAge: 0, MaxAge: 0,
...@@ -84,7 +84,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc { ...@@ -84,7 +84,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
} }
{ {
sess, _ := session.Get("session", c) sess, _ := session.Get("memos_session", c)
userIDValue := sess.Values[userIDContextKey] userIDValue := sess.Values[userIDContextKey]
if userIDValue != nil { if userIDValue != nil {
userID, _ := strconv.Atoi(fmt.Sprintf("%v", userIDValue)) userID, _ := strconv.Atoi(fmt.Sprintf("%v", userIDValue))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment