Skip to content

The open alternative to Salesforce, designed for AI.

Update Error Handling for 2FA Requirements in Impersonation (#14963)

twill-hq[bot]dd4cc98b8a89
diff --git a/packages/twenty-server/src/engine/core-modules/impersonation/services/impersonation.service.ts b/packages/twenty-server/src/engine/core-modules/impersonation/services/impersonation.service.ts
index 29587d27edb..fef3f784aab 100644
--- a/packages/twenty-server/src/engine/core-modules/impersonation/services/impersonation.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/impersonation/services/impersonation.service.ts
@@ -102,7 +102,7 @@ export class ImpersonationService {
if (!has2FAEnabled) {
throw new AuthException(
'Two-factor authentication is required for server-level impersonation. Please enable 2FA in your workspace settings before attempting to impersonate users.',
- AuthExceptionCode.FORBIDDEN_EXCEPTION,
+ AuthExceptionCode.TWO_FACTOR_AUTHENTICATION_PROVISION_REQUIRED,
);
}