From 85404561626cc3e7952bab42a54a2533be9062ed Mon Sep 17 00:00:00 2001 From: Jannic Veith Date: Tue, 3 Sep 2024 08:46:43 +0200 Subject: [PATCH] Dont replace underscores --- apps/server-asset-sg/src/core/middleware/jwt.middleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/server-asset-sg/src/core/middleware/jwt.middleware.ts b/apps/server-asset-sg/src/core/middleware/jwt.middleware.ts index 28395ea5..8d1fc4f1 100644 --- a/apps/server-asset-sg/src/core/middleware/jwt.middleware.ts +++ b/apps/server-asset-sg/src/core/middleware/jwt.middleware.ts @@ -190,7 +190,7 @@ export class JwtMiddleware implements NestMiddleware { if (!('username' in payload) || payload.username.length === 0) { throw new HttpException('invalid JWT payload: missing username', 401); } - const email = payload.username.split('_').slice(1).join(''); + const email = payload.username.split('_').slice(1).join('_'); if (email == null || !/^.+@.+\..+$/.test(email)) { throw new HttpException('invalid JWT payload: username does not contain an email', 401); }