mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-12-24 08:12:55 +08:00
修复验证码验证
This commit is contained in:
@@ -85,11 +85,11 @@ func (c *ClickWordCaptchaService) Check(token string, pointJson string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fontsize := c.factory.config.ClickWord.FontSize
|
||||
fontSize := c.factory.config.ClickWord.FontSize
|
||||
for i, pointVO := range cachePoint {
|
||||
targetPoint := userPoint[i]
|
||||
|
||||
if targetPoint.X >= pointVO.X-10 && targetPoint.X <= pointVO.X+fontsize+10 && targetPoint.Y >= pointVO.Y-10 && targetPoint.Y <= pointVO.Y+fontsize+10 {
|
||||
if targetPoint.X >= pointVO.X-10 && targetPoint.X <= pointVO.X+fontSize+10 && targetPoint.Y >= pointVO.Y-10 && targetPoint.Y <= pointVO.Y+fontSize+10 {
|
||||
|
||||
} else {
|
||||
return errors.New("验证失败")
|
||||
|
||||
@@ -31,7 +31,8 @@ type ImageUtil struct {
|
||||
func NewImageUtil(src string, fontPath string) *ImageUtil {
|
||||
srcImage := OpenPngImage(src)
|
||||
|
||||
return &ImageUtil{Src: src,
|
||||
return &ImageUtil{
|
||||
Src: src,
|
||||
SrcImage: srcImage,
|
||||
RgbaImage: ImageToRGBA(srcImage),
|
||||
Width: srcImage.Bounds().Dx(),
|
||||
|
||||
Reference in New Issue
Block a user