mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
Add two factor authentication for users who wish to enhance the security of their accounts.
18 lines
435 B
TypeScript
18 lines
435 B
TypeScript
import { User } from '@documenso/prisma/client';
|
|
|
|
import { DOCUMENSO_ENCRYPTION_KEY } from '../../constants/crypto';
|
|
|
|
type IsTwoFactorAuthenticationEnabledOptions = {
|
|
user: User;
|
|
};
|
|
|
|
export const isTwoFactorAuthenticationEnabled = ({
|
|
user,
|
|
}: IsTwoFactorAuthenticationEnabledOptions) => {
|
|
return (
|
|
user.twoFactorEnabled &&
|
|
user.identityProvider === 'DOCUMENSO' &&
|
|
typeof DOCUMENSO_ENCRYPTION_KEY === 'string'
|
|
);
|
|
};
|