fix: Do not check verification if platform emails are not enabled

This commit is contained in:
Dries Augustyns
2025-12-20 20:12:43 +01:00
parent 1a5607f278
commit 9567144390
+6 -1
View File
@@ -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();