Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x | import Koa from 'koa'; import { getLog } from '@services/internal/logService'; import { errorResponse } from '../misc/httpResponse/errorResponse'; import { getCaptchaService } from '@services/external/captchaService'; export const hasCaptcha = (captchaString: string) => async (ctx: Koa.DefaultContext, next: () => Promise<Koa.BaseResponse>): Promise<boolean> => { if (captchaString == null || `${captchaString}`.length < 10) { const errMsg = 'Captcha - not supplied'; getLog().i(errMsg); await errorResponse({ ctx, next, statusCode: 401, message: errMsg, }); return false; } const captchaResponse = await getCaptchaService().verifyToken(captchaString); return captchaResponse.isSuccess; }; |