|
|
|
|
@ -120,12 +120,12 @@ func (s *server) GenerateCaptcha(ctx context.Context, _ *pbcaptcha.GenerateCaptc
|
|
|
|
|
log.ZError(ctx, "captcha insert mongodb failed", err, "captchaID", id)
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
_ = tileImage
|
|
|
|
|
return &pbcaptcha.GenerateCaptchaResp{
|
|
|
|
|
CaptchaID: id,
|
|
|
|
|
MasterImage: masterImage,
|
|
|
|
|
ThumbImage: tileImage,
|
|
|
|
|
TileImage: tileImage,
|
|
|
|
|
ExpireAt: expiredAt.Unix(),
|
|
|
|
|
TileY: int32(block.Y),
|
|
|
|
|
}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -159,11 +159,7 @@ func (s *server) VerifyCaptcha(ctx context.Context, req *pbcaptcha.VerifyCaptcha
|
|
|
|
|
log.ZWarn(ctx, "captcha expired", nil, "captchaID", req.CaptchaID, "expiredAt", doc.ExpiredAt.Unix())
|
|
|
|
|
return nil, servererrs.ErrFileUploadedExpired.WrapMsg("captcha expired", "captchaID", req.CaptchaID)
|
|
|
|
|
}
|
|
|
|
|
var x, y int32
|
|
|
|
|
if pts := req.GetClickPoints(); len(pts) > 0 && pts[0] != nil {
|
|
|
|
|
x = pts[0].GetX()
|
|
|
|
|
y = pts[0].GetY()
|
|
|
|
|
}
|
|
|
|
|
x, y := req.GetX(), req.GetY()
|
|
|
|
|
success := slide.Validate(int(x), int(y), doc.X, doc.Y, s.conf.VerifyPadding)
|
|
|
|
|
if !success {
|
|
|
|
|
log.ZError(ctx, "captcha validate failed", nil, "captchaID", req.CaptchaID, "x", x, "y", y, "docX", doc.X, "docY", doc.Y)
|
|
|
|
|
|