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();