mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-06-27 21:08:23 +08:00
redpacket
This commit is contained in:
parent
3cbd9a37dd
commit
6962845799
@ -41,7 +41,7 @@ func (c *CaptchaApi) VerifyCaptcha(ctx *gin.Context) {
|
||||
}
|
||||
resp, err := c.Client.VerifyCaptcha(ctx, req)
|
||||
if err != nil {
|
||||
log.ZError(ctx, "captcha verify rpc failed", err, "captchaID", req.GetCaptchaID(), "clickPoints", req.GetClickPoints())
|
||||
log.ZError(ctx, "captcha verify rpc failed", err, "captchaID", req.GetCaptchaID(), "x", req.GetX(), "y", req.GetY())
|
||||
apiresp.GinError(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user