mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 17:21:41 +10:00
refactor: refine document 2FA components
This commit is contained in:
@ -176,7 +176,7 @@ export const DocumentSigningAuth2FA = ({
|
|||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button type="submit" loading={isCurrentlyAuthenticating}>
|
<Button type="submit" loading={isCurrentlyAuthenticating}>
|
||||||
<Trans>Sign</Trans>
|
<Trans>{actionTarget === 'DOCUMENT' ? 'Sign Document' : 'Sign Field'}</Trans>
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -27,7 +27,6 @@ export type DocumentSigningAuthDialogProps = {
|
|||||||
actionTarget: FieldType | 'DOCUMENT';
|
actionTarget: FieldType | 'DOCUMENT';
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onOpenChange: (value: boolean) => void;
|
onOpenChange: (value: boolean) => void;
|
||||||
isEnterprise: boolean;
|
|
||||||
/**
|
/**
|
||||||
* The callback to run when the reauth form is filled out.
|
* The callback to run when the reauth form is filled out.
|
||||||
*/
|
*/
|
||||||
@ -38,10 +37,10 @@ export const DocumentSigningAuthDialog = ({
|
|||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
documentAuthType,
|
documentAuthType,
|
||||||
|
actionTarget,
|
||||||
open,
|
open,
|
||||||
onOpenChange,
|
onOpenChange,
|
||||||
onReauthFormSubmit,
|
onReauthFormSubmit,
|
||||||
isEnterprise,
|
|
||||||
}: DocumentSigningAuthDialogProps) => {
|
}: DocumentSigningAuthDialogProps) => {
|
||||||
const { recipient, user, isCurrentlyAuthenticating } = useRequiredDocumentSigningAuthContext();
|
const { recipient, user, isCurrentlyAuthenticating } = useRequiredDocumentSigningAuthContext();
|
||||||
|
|
||||||
@ -57,10 +56,22 @@ export const DocumentSigningAuthDialog = ({
|
|||||||
<Dialog open={open} onOpenChange={handleOnOpenChange}>
|
<Dialog open={open} onOpenChange={handleOnOpenChange}>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>{title || <Trans>Sign field</Trans>}</DialogTitle>
|
<DialogTitle>
|
||||||
|
{title ||
|
||||||
|
(actionTarget === 'DOCUMENT' ? (
|
||||||
|
<Trans>Sign document</Trans>
|
||||||
|
) : (
|
||||||
|
<Trans>Sign field</Trans>
|
||||||
|
))}
|
||||||
|
</DialogTitle>
|
||||||
|
|
||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
{description || <Trans>Reauthentication is required to sign this field</Trans>}
|
{description || (
|
||||||
|
<Trans>
|
||||||
|
Reauthentication is required to sign this{' '}
|
||||||
|
{actionTarget === 'DOCUMENT' ? 'document' : 'field'}
|
||||||
|
</Trans>
|
||||||
|
)}
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
@ -79,6 +90,7 @@ export const DocumentSigningAuthDialog = ({
|
|||||||
))
|
))
|
||||||
.with({ documentAuthType: DocumentAuth.TWO_FACTOR_AUTH }, () => (
|
.with({ documentAuthType: DocumentAuth.TWO_FACTOR_AUTH }, () => (
|
||||||
<DocumentSigningAuth2FA
|
<DocumentSigningAuth2FA
|
||||||
|
actionTarget={actionTarget === 'DOCUMENT' ? 'DOCUMENT' : 'FIELD'}
|
||||||
open={open}
|
open={open}
|
||||||
onOpenChange={onOpenChange}
|
onOpenChange={onOpenChange}
|
||||||
onReauthFormSubmit={onReauthFormSubmit}
|
onReauthFormSubmit={onReauthFormSubmit}
|
||||||
|
|||||||
@ -218,7 +218,6 @@ export const DocumentSigningAuthProvider = ({
|
|||||||
onReauthFormSubmit={documentAuthDialogPayload.onReauthFormSubmit}
|
onReauthFormSubmit={documentAuthDialogPayload.onReauthFormSubmit}
|
||||||
actionTarget={documentAuthDialogPayload.actionTarget}
|
actionTarget={documentAuthDialogPayload.actionTarget}
|
||||||
documentAuthType={derivedRecipientActionAuth}
|
documentAuthType={derivedRecipientActionAuth}
|
||||||
isEnterprise={isEnterprise}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</DocumentSigningAuthContext.Provider>
|
</DocumentSigningAuthContext.Provider>
|
||||||
|
|||||||
Reference in New Issue
Block a user