From a6ce4630f54cf1ff962a82f5175a6abc9255d2c7 Mon Sep 17 00:00:00 2001 From: Maix0 <39835848+Maix0@users.noreply.github.com> Date: Sun, 31 Aug 2025 16:36:16 +0200 Subject: [PATCH] feat(jwtPlugin): correctly check for multiple registration Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/@shared/src/auth/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/@shared/src/auth/index.ts b/src/@shared/src/auth/index.ts index 6a80b8a..c41aa26 100644 --- a/src/@shared/src/auth/index.ts +++ b/src/@shared/src/auth/index.ts @@ -31,7 +31,8 @@ declare module "fastify" { export const Otp = OTP; let jwtAdded = false; export const jwtPlugin = fp(async (fastify, _opts) => { - if (jwtAdded) jwtAdded = true; + if (jwtAdded) return; + jwtAdded = true; let env = process.env.JWT_SECRET; if (isNullish(env)) throw "JWT_SECRET is not defined"; if (!fastify.hasDecorator("signJwt")) {