mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 16:58:49 +01:00
🎨 Record access authorization login log https://github.com/siyuan-note/siyuan/issues/10578
This commit is contained in:
parent
7f82fc21af
commit
92e4d3951b
1 changed files with 5 additions and 0 deletions
|
|
@ -71,18 +71,21 @@ func LoginAuth(c *gin.Context) {
|
|||
if nil == captchaArg {
|
||||
ret.Code = 1
|
||||
ret.Msg = Conf.Language(21)
|
||||
logging.LogWarnf("invalid captcha")
|
||||
return
|
||||
}
|
||||
inputCaptcha = captchaArg.(string)
|
||||
if "" == inputCaptcha {
|
||||
ret.Code = 1
|
||||
ret.Msg = Conf.Language(21)
|
||||
logging.LogWarnf("invalid captcha")
|
||||
return
|
||||
}
|
||||
|
||||
if strings.ToLower(workspaceSession.Captcha) != strings.ToLower(inputCaptcha) {
|
||||
ret.Code = 1
|
||||
ret.Msg = Conf.Language(22)
|
||||
logging.LogWarnf("invalid captcha")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -91,6 +94,7 @@ func LoginAuth(c *gin.Context) {
|
|||
if Conf.AccessAuthCode != authCode {
|
||||
ret.Code = -1
|
||||
ret.Msg = Conf.Language(83)
|
||||
logging.LogWarnf("invalid auth code")
|
||||
|
||||
util.WrongAuthCount++
|
||||
workspaceSession.Captcha = gulu.Rand.String(7)
|
||||
|
|
@ -109,6 +113,7 @@ func LoginAuth(c *gin.Context) {
|
|||
workspaceSession.AccessAuthCode = authCode
|
||||
util.WrongAuthCount = 0
|
||||
workspaceSession.Captcha = gulu.Rand.String(7)
|
||||
logging.LogInfof("auth success")
|
||||
if err := session.Save(c); nil != err {
|
||||
logging.LogErrorf("save session failed: " + err.Error())
|
||||
c.Status(http.StatusInternalServerError)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue