mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Improve auth
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
67c7dd1e06
commit
eec003b303
2 changed files with 12 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ import (
|
|||
"github.com/88250/gulu"
|
||||
ginSessions "github.com/gin-contrib/sessions"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/siyuan-note/logging"
|
||||
)
|
||||
|
||||
var WrongAuthCount int
|
||||
|
|
@ -38,6 +39,14 @@ type WorkspaceSession struct {
|
|||
Captcha string
|
||||
}
|
||||
|
||||
func (sd *SessionData) Clear(c *gin.Context) {
|
||||
session := ginSessions.Default(c)
|
||||
session.Delete("data")
|
||||
if err := session.Save(); err != nil {
|
||||
logging.LogErrorf("clear session failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Save saves the current session of the specified context.
|
||||
func (sd *SessionData) Save(c *gin.Context) error {
|
||||
session := ginSessions.Default(c)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue