Merge pull request #4101 from Infisical/fix/authEnforcedMemberInviteCheck

Fix authEnforced returning a token when org has authEnforced enabled
This commit is contained in:
carlosmonastyrski
2025-07-14 18:01:32 -03:00
committed by GitHub

View File

@@ -1274,6 +1274,8 @@ export const orgServiceFactory = ({
message: "No pending invitation found"
});
const organization = await orgDAL.findById(orgId);
await tokenService.validateTokenForUser({
type: TokenType.TOKEN_EMAIL_ORG_INVITATION,
userId: user.id,
@@ -1296,6 +1298,13 @@ export const orgServiceFactory = ({
return { user };
}
if (
organization.authEnforced &&
!(organization.bypassOrgAuthEnabled && orgMembership.role === OrgMembershipRole.Admin)
) {
return { user };
}
const appCfg = getConfig();
const token = jwt.sign(
{