Skip to content

The open alternative to Salesforce, designed for AI.

1.1 KB
Raw Blame
import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';
import { useLingui } from '@lingui/react/macro';

type SettingsAdminRevokeSigningKeyConfirmationModalProps = {
  modalInstanceId: string;
  isCurrent: boolean;
  onConfirm: () => void;
  onClose?: () => void;
};

export const SettingsAdminRevokeSigningKeyConfirmationModal = ({
  modalInstanceId,
  isCurrent,
  onConfirm,
  onClose,
}: SettingsAdminRevokeSigningKeyConfirmationModalProps) => {
  const { t } = useLingui();
  const subtitle = isCurrent
    ? t`This is the current signing key. Revoking it will invalidate every JWT signed with it and users may need to sign in again. A new signing key will be generated automatically on the next request.`
    : t`Revoking this key will invalidate every JWT signed with it. Users with active tokens signed by this key will be logged out.`;

  return (
    <ConfirmationDialog
      dialogId={modalInstanceId}
      title={t`Revoke signing key`}
      subtitle={subtitle}
      onConfirmClick={onConfirm}
      onClose={onClose}
      confirmButtonText={t`Revoke`}
      confirmButtonColor="danger"
    />
  );
};