File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,13 @@ func LoginAuth(c *gin.Context) {
9292 ret .Code = 1
9393 ret .Msg = Conf .Language (22 )
9494 logging .LogWarnf ("invalid captcha" )
95+
96+ workspaceSession .Captcha = gulu .Rand .String (7 ) // https://github.com/siyuan-note/siyuan/issues/13147
97+ if err := session .Save (c ); err != nil {
98+ logging .LogErrorf ("save session failed: " + err .Error ())
99+ c .Status (http .StatusInternalServerError )
100+ return
101+ }
95102 return
96103 }
97104 }
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ import (
3636 "github.com/emersion/go-webdav/carddav"
3737 "github.com/gin-contrib/gzip"
3838 "github.com/gin-contrib/sessions"
39- "github.com/gin-contrib/sessions/memstore "
39+ "github.com/gin-contrib/sessions/cookie "
4040 "github.com/gin-gonic/gin"
4141 "github.com/mssola/useragent"
4242 "github.com/olahol/melody"
@@ -61,8 +61,7 @@ const (
6161)
6262
6363var (
64- // 这里用的是内存存储,意味着重启后所有 session 会丢失,需要重新登录
65- sessionStore = memstore .NewStore ([]byte ("ATN51UlxVq1Gcvdf" ))
64+ sessionStore = cookie .NewStore ([]byte ("ATN51UlxVq1Gcvdf" ))
6665
6766 HttpMethods = []string {
6867 http .MethodGet ,
You can’t perform that action at this time.
0 commit comments