added new condition for security
This commit is contained in:
@@ -5,6 +5,7 @@ import { PrismaService } from '../../../common/database/prisma.service';
|
||||
import ApiError from '../../../common/utils/helper/ApiError';
|
||||
import * as bcrypt from 'bcryptjs';
|
||||
import { generateOtpHelper } from '../../../common/utils/helper/sendOtp';
|
||||
import { ROLE } from '@/common/utils/constants/common.constant';
|
||||
|
||||
const prismaService = new PrismaService();
|
||||
const minglarService = new MinglarService(prismaService);
|
||||
@@ -33,7 +34,7 @@ export const handler = safeHandler(async (
|
||||
select: { emailAddress: true, id: true, userPassword: true, roleXid: true },
|
||||
});
|
||||
|
||||
if(!user){
|
||||
if(!user || ![ROLE.MINGLAR_ADMIN, ROLE.CO_ADMIN, ROLE.ACCOUNT_MANAGER].includes(user.roleXid)){
|
||||
throw new ApiError(404, 'You are not allowed to register directly. Please contact minglar admin.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user