mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 07:43:16 +10:00
## Description Fixed issue where accounts that were initially created via email/password, then linked to an SSO account, can bypass the 2FA during login if they use their email password. ## Testing Performed Tested locally, and 2FA is now required for linked SSO accounts
14 lines
381 B
TypeScript
14 lines
381 B
TypeScript
import type { User } from '@documenso/prisma/client';
|
|
|
|
import { DOCUMENSO_ENCRYPTION_KEY } from '../../constants/crypto';
|
|
|
|
type IsTwoFactorAuthenticationEnabledOptions = {
|
|
user: User;
|
|
};
|
|
|
|
export const isTwoFactorAuthenticationEnabled = ({
|
|
user,
|
|
}: IsTwoFactorAuthenticationEnabledOptions) => {
|
|
return user.twoFactorEnabled && typeof DOCUMENSO_ENCRYPTION_KEY === 'string';
|
|
};
|