mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 01:45:08 +10:00
fix: move 2FA reason codes to shared constants to fix client bundle
Importing SIGNING_2FA_VERIFY_REASON_CODES from a server-only module pulled prisma into the browser bundle, causing "process is not defined" and breaking all client-side JS hydration.
This commit is contained in:
+1
-1
@@ -5,8 +5,8 @@ import { Trans } from '@lingui/react/macro';
|
|||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
import { SIGNING_2FA_VERIFY_REASON_CODES } from '@documenso/lib/constants/document-auth';
|
||||||
import { AppError } from '@documenso/lib/errors/app-error';
|
import { AppError } from '@documenso/lib/errors/app-error';
|
||||||
import { SIGNING_2FA_VERIFY_REASON_CODES } from '@documenso/lib/server-only/signing-2fa/verify-signing-two-factor-token';
|
|
||||||
import { DocumentAuth, type TRecipientActionAuth } from '@documenso/lib/types/document-auth';
|
import { DocumentAuth, type TRecipientActionAuth } from '@documenso/lib/types/document-auth';
|
||||||
import { trpc } from '@documenso/trpc/react';
|
import { trpc } from '@documenso/trpc/react';
|
||||||
import { Alert, AlertDescription, AlertTitle } from '@documenso/ui/primitives/alert';
|
import { Alert, AlertDescription, AlertTitle } from '@documenso/ui/primitives/alert';
|
||||||
|
|||||||
@@ -35,3 +35,12 @@ export const DOCUMENT_AUTH_TYPES: Record<string, DocumentAuthTypeData> = {
|
|||||||
value: msg`None (Overrides global settings)`,
|
value: msg`None (Overrides global settings)`,
|
||||||
},
|
},
|
||||||
} satisfies Record<TDocumentAuth, DocumentAuthTypeData>;
|
} satisfies Record<TDocumentAuth, DocumentAuthTypeData>;
|
||||||
|
|
||||||
|
export const SIGNING_2FA_VERIFY_REASON_CODES = {
|
||||||
|
TWO_FA_TOKEN_INVALID: 'TWO_FA_TOKEN_INVALID',
|
||||||
|
TWO_FA_TOKEN_EXPIRED: 'TWO_FA_TOKEN_EXPIRED',
|
||||||
|
TWO_FA_TOKEN_REVOKED: 'TWO_FA_TOKEN_REVOKED',
|
||||||
|
TWO_FA_TOKEN_CONSUMED: 'TWO_FA_TOKEN_CONSUMED',
|
||||||
|
TWO_FA_ATTEMPT_LIMIT_REACHED: 'TWO_FA_ATTEMPT_LIMIT_REACHED',
|
||||||
|
TWO_FA_NOT_ISSUED: 'TWO_FA_NOT_ISSUED',
|
||||||
|
} as const;
|
||||||
|
|||||||
@@ -1,20 +1,14 @@
|
|||||||
import { prisma } from '@documenso/prisma';
|
import { prisma } from '@documenso/prisma';
|
||||||
|
|
||||||
|
import { SIGNING_2FA_VERIFY_REASON_CODES } from '../../constants/document-auth';
|
||||||
import { AppError, AppErrorCode } from '../../errors/app-error';
|
import { AppError, AppErrorCode } from '../../errors/app-error';
|
||||||
import { DOCUMENT_AUDIT_LOG_TYPE } from '../../types/document-audit-logs';
|
import { DOCUMENT_AUDIT_LOG_TYPE } from '../../types/document-audit-logs';
|
||||||
import { createDocumentAuditLogData } from '../../utils/document-audit-logs';
|
import { createDocumentAuditLogData } from '../../utils/document-audit-logs';
|
||||||
import { verifyTokenHash } from './token-utils';
|
import { verifyTokenHash } from './token-utils';
|
||||||
|
|
||||||
const PROOF_TTL_MINUTES = 10;
|
export { SIGNING_2FA_VERIFY_REASON_CODES };
|
||||||
|
|
||||||
export const SIGNING_2FA_VERIFY_REASON_CODES = {
|
const PROOF_TTL_MINUTES = 10;
|
||||||
TWO_FA_TOKEN_INVALID: 'TWO_FA_TOKEN_INVALID',
|
|
||||||
TWO_FA_TOKEN_EXPIRED: 'TWO_FA_TOKEN_EXPIRED',
|
|
||||||
TWO_FA_TOKEN_REVOKED: 'TWO_FA_TOKEN_REVOKED',
|
|
||||||
TWO_FA_TOKEN_CONSUMED: 'TWO_FA_TOKEN_CONSUMED',
|
|
||||||
TWO_FA_ATTEMPT_LIMIT_REACHED: 'TWO_FA_ATTEMPT_LIMIT_REACHED',
|
|
||||||
TWO_FA_NOT_ISSUED: 'TWO_FA_NOT_ISSUED',
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export type VerifySigningTwoFactorTokenOptions = {
|
export type VerifySigningTwoFactorTokenOptions = {
|
||||||
recipientId: number;
|
recipientId: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user