MCPcopy
hub / github.com/apache/answer / VerifyCaptcha

Method VerifyCaptcha

internal/service/action/captcha_service.go:152–162  ·  view source on GitHub ↗

VerifyCaptcha generate captcha

(ctx context.Context, key, captcha string)

Source from the content-addressed store, hash-verified

150
151// VerifyCaptcha generate captcha
152func (cs *CaptchaService) VerifyCaptcha(ctx context.Context, key, captcha string) (isCorrect bool, err error) {
153 realCaptcha, _ := cs.captchaRepo.GetCaptcha(ctx, key)
154
155 _ = plugin.CallCaptcha(func(fn plugin.Captcha) error {
156 isCorrect = fn.Verify(realCaptcha, captcha)
157 return nil
158 })
159
160 _ = cs.captchaRepo.DelCaptcha(ctx, key)
161 return isCorrect, nil
162}

Callers 1

Calls 4

CallCaptchaFunction · 0.92
VerifyMethod · 0.80
GetCaptchaMethod · 0.65
DelCaptchaMethod · 0.65

Tested by

no test coverage detected