🔒 改进访问授权验证码安全性 Fix https://github.com/siyuan-note/siyuan/issues/5452

This commit is contained in:
Liang Ding 2022-07-18 23:03:03 +08:00
parent 9f7d2182be
commit 20930e0f69
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 17 additions and 12 deletions

View file

@ -22,16 +22,16 @@ import (
"github.com/gin-gonic/gin"
)
// SessionData represents the session.
type SessionData struct {
ID int
AccessAuthCode string
WrongAuthCount int
Captcha string
var WrongAuthCount int
func NeedCaptcha() bool {
return 3 < WrongAuthCount
}
func (sd *SessionData) NeedCaptcha() bool {
return 3 < sd.WrongAuthCount
// SessionData represents the session.
type SessionData struct {
AccessAuthCode string
Captcha string
}
// Save saves the current session of the specified context.