From 9567144390512173f7f615db71368c1cd26d9f4d Mon Sep 17 00:00:00 2001 From: Dries Augustyns Date: Sat, 20 Dec 2025 20:12:43 +0100 Subject: [PATCH] fix: Do not check verification if platform emails are not enabled --- apps/api/src/middleware/auth.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/api/src/middleware/auth.ts b/apps/api/src/middleware/auth.ts index 4ca606c..6893a72 100644 --- a/apps/api/src/middleware/auth.ts +++ b/apps/api/src/middleware/auth.ts @@ -2,7 +2,7 @@ import dayjs from 'dayjs'; import type {NextFunction, Request, Response} from 'express'; import jsonwebtoken from 'jsonwebtoken'; -import {JWT_SECRET} from '../app/constants.js'; +import {JWT_SECRET, PLUNK_ENABLED} from '../app/constants.js'; import {prisma} from '../database/prisma.js'; import {ErrorCode, HttpException, NotAuthenticated} from '../exceptions/index.js'; @@ -429,6 +429,11 @@ export const requireEmailVerified = async (req: Request, res: Response, next: Ne throw new NotAuthenticated(); } + // If platform email verification is disabled, skip check + if (!PLUNK_ENABLED) { + return next(); + } + // OAuth users are always considered verified if (user.type !== 'PASSWORD') { return next();