mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-07-25 00:55:42 +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)
|
resp, err := c.Client.VerifyCaptcha(ctx, req)
|
||||||
if err != nil {
|
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)
|
apiresp.GinError(ctx, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,12 +120,12 @@ func (s *server) GenerateCaptcha(ctx context.Context, _ *pbcaptcha.GenerateCaptc
|
|||||||
log.ZError(ctx, "captcha insert mongodb failed", err, "captchaID", id)
|
log.ZError(ctx, "captcha insert mongodb failed", err, "captchaID", id)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
_ = tileImage
|
|
||||||
return &pbcaptcha.GenerateCaptchaResp{
|
return &pbcaptcha.GenerateCaptchaResp{
|
||||||
CaptchaID: id,
|
CaptchaID: id,
|
||||||
MasterImage: masterImage,
|
MasterImage: masterImage,
|
||||||
ThumbImage: tileImage,
|
TileImage: tileImage,
|
||||||
ExpireAt: expiredAt.Unix(),
|
ExpireAt: expiredAt.Unix(),
|
||||||
|
TileY: int32(block.Y),
|
||||||
}, nil
|
}, 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())
|
log.ZWarn(ctx, "captcha expired", nil, "captchaID", req.CaptchaID, "expiredAt", doc.ExpiredAt.Unix())
|
||||||
return nil, servererrs.ErrFileUploadedExpired.WrapMsg("captcha expired", "captchaID", req.CaptchaID)
|
return nil, servererrs.ErrFileUploadedExpired.WrapMsg("captcha expired", "captchaID", req.CaptchaID)
|
||||||
}
|
}
|
||||||
var x, y int32
|
x, y := req.GetX(), req.GetY()
|
||||||
if pts := req.GetClickPoints(); len(pts) > 0 && pts[0] != nil {
|
|
||||||
x = pts[0].GetX()
|
|
||||||
y = pts[0].GetY()
|
|
||||||
}
|
|
||||||
success := slide.Validate(int(x), int(y), doc.X, doc.Y, s.conf.VerifyPadding)
|
success := slide.Validate(int(x), int(y), doc.X, doc.Y, s.conf.VerifyPadding)
|
||||||
if !success {
|
if !success {
|
||||||
log.ZError(ctx, "captcha validate failed", nil, "captchaID", req.CaptchaID, "x", x, "y", y, "docX", doc.X, "docY", doc.Y)
|
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