Browse Source

:art: 访问授权码输入错误 3 次后加入验证码 https://github.com/siyuan-note/siyuan/issues/5429

Liang Ding 3 years ago
parent
commit
a32e2eb1c0
1 changed files with 2 additions and 3 deletions
  1. 2 3
      kernel/model/session.go

+ 2 - 3
kernel/model/session.go

@@ -71,7 +71,7 @@ func LoginAuth(c *gin.Context) {
 		}
 		inputCaptcha = captchaArg.(string)
 
-		if session.Captcha != inputCaptcha {
+		if strings.ToLower(session.Captcha) != strings.ToLower(inputCaptcha) {
 			ret.Code = 1
 			ret.Msg = Conf.Language(22)
 			return
@@ -109,10 +109,9 @@ func LoginAuth(c *gin.Context) {
 
 func GetCaptcha(c *gin.Context) {
 	img, err := captcha.New(100, 26, func(options *captcha.Options) {
-		options.CharPreset = "abcdefghjkmnpqrtuvwxyz2346789"
+		options.CharPreset = "ABCDEFGHKLMNPQRSTUVWXYZ23456789"
 		options.Noise = 0.5
 		options.CurveNumber = 0
-		options.FontScale = 1.2
 	})
 	if nil != err {
 		util.LogErrorf("generates captcha failed: " + err.Error())