This commit is contained in:
Daniel 2025-06-05 17:12:33 +08:00
parent f3fe90cbd8
commit 46d6fbf033
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 9 additions and 3 deletions

View file

@ -92,6 +92,13 @@ func LoginAuth(c *gin.Context) {
ret.Code = 1
ret.Msg = Conf.Language(22)
logging.LogWarnf("invalid captcha")
workspaceSession.Captcha = gulu.Rand.String(7) // https://github.com/siyuan-note/siyuan/issues/13147
if err := session.Save(c); err != nil {
logging.LogErrorf("save session failed: " + err.Error())
c.Status(http.StatusInternalServerError)
return
}
return
}
}

View file

@ -36,7 +36,7 @@ import (
"github.com/emersion/go-webdav/carddav"
"github.com/gin-contrib/gzip"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/memstore"
"github.com/gin-contrib/sessions/cookie"
"github.com/gin-gonic/gin"
"github.com/mssola/useragent"
"github.com/olahol/melody"
@ -61,8 +61,7 @@ const (
)
var (
// 这里用的是内存存储,意味着重启后所有 session 会丢失,需要重新登录
sessionStore = memstore.NewStore([]byte("ATN51UlxVq1Gcvdf"))
sessionStore = cookie.NewStore([]byte("ATN51UlxVq1Gcvdf"))
HttpMethods = []string{
http.MethodGet,