mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-14 00:16:13 +01:00
🎨 访问授权码输入错误 3 次后加入验证码 https://github.com/siyuan-note/siyuan/issues/5429
This commit is contained in:
parent
b4208bbf36
commit
091214f573
7 changed files with 235 additions and 21 deletions
|
|
@ -63,20 +63,21 @@ func LoginAuth(c *gin.Context) {
|
|||
var inputCaptcha string
|
||||
session := util.GetSession(c)
|
||||
if session.NeedCaptcha() {
|
||||
captchaArg := arg["captcha"]
|
||||
if nil == captchaArg {
|
||||
c.Status(400)
|
||||
ret.Code = -1
|
||||
ret.Msg = "need input captcha"
|
||||
return
|
||||
}
|
||||
inputCaptcha = captchaArg.(string)
|
||||
|
||||
if session.Captcha != inputCaptcha {
|
||||
ret.Code = -1
|
||||
ret.Msg = "invalid captcha"
|
||||
return
|
||||
}
|
||||
_ = inputCaptcha
|
||||
//captchaArg := arg["captcha"]
|
||||
//if nil == captchaArg {
|
||||
// c.Status(400)
|
||||
// ret.Code = -1
|
||||
// ret.Msg = "need input captcha"
|
||||
// return
|
||||
//}
|
||||
//inputCaptcha = captchaArg.(string)
|
||||
//
|
||||
//if session.Captcha != inputCaptcha {
|
||||
// ret.Code = -1
|
||||
// ret.Msg = "invalid captcha"
|
||||
// return
|
||||
//}
|
||||
}
|
||||
|
||||
authCode := arg["authCode"].(string)
|
||||
|
|
@ -98,6 +99,7 @@ func LoginAuth(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
session.AccessAuthCode = authCode
|
||||
session.WrongAuthCount = 0
|
||||
session.Captcha = gulu.Rand.String(7)
|
||||
if err := session.Save(c); nil != err {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue