验证码忽略大小写

This commit is contained in:
Shikong 2022-10-25 02:01:30 +08:00
parent 9192b4d35a
commit a4a9b27e5a

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
"github.com/mojocn/base64Captcha" "github.com/mojocn/base64Captcha"
"strings"
"time" "time"
) )
@ -44,6 +45,6 @@ func (c *CaptchaStore) Get(id string, clear bool) string {
} }
func (c *CaptchaStore) Verify(id, answer string, clear bool) (match bool) { func (c *CaptchaStore) Verify(id, answer string, clear bool) (match bool) {
match = c.Get(id, clear) == answer match = strings.EqualFold(c.Get(id, clear), answer)
return return
} }