diff --git a/src/routes/index.ts b/src/routes/index.ts index c34185f..bd0926f 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -55,10 +55,18 @@ const EmailPromptRequest = z.object({ }); const handleEmailPromptSubmission: RequestHandler<{}, z.infer> = async (req, res, _next) => { + try { + EmailPromptRequest.parse(req.body); + } catch (e) { + logger.log('error', 'error while parsing the request'); + _next(createError(500)); + return; + } const { email, countryCode, phone, recaptcha, idType, } = EmailPromptRequest.parse(req.body); + let idInput = ''; if (ID_TYPE === 'EUID') { if (!isValidEmail(email)) { @@ -146,7 +154,7 @@ const defaultRouteHandler: RequestHandler<{}, {}, z.infer