feat: move totp and passkeys into plugins (C1)

This commit is contained in:
LukeGus committed 2026-09-24 16:57:24 -05:00
1 parent f4f26a9b8b
commit 5c18435105
235 files changed
+22545 -5610

No files matched your search

+3 -50
View File
@@ -11,7 +11,6 @@ import {
Pencil,
Plus,
RefreshCw,
ShieldOff,
SquareTerminal,
Trash2,
TriangleAlert,
@@ -30,7 +29,6 @@ import {
adminUpdateUserSnippet,
adminDeleteUserSnippet,
adminResetUserPassword,
adminDisableUserTotp,
adminExportUserData,
getSessions,
revokeSession,
@@ -112,14 +110,14 @@ export function AdminUserManagePanel({
onBack,
onOpenHostTab,
onUserDeleted,
onTotpDisabled,
onSecondFactorsReset,
}: {
user: AdminUser;
roles: Role[];
onBack: () => void;
onOpenHostTab?: (host: Host) => void;
onUserDeleted: () => void;
onTotpDisabled: () => void;
onSecondFactorsReset: () => void;
}) {
const { t } = useTranslation();
const [activeTab, setActiveTab] = useState<ManageTabId>("account");
@@ -172,7 +170,6 @@ export function AdminUserManagePanel({
// Account tab state
const [resetPassword, setResetPassword] = useState("");
const [resetLoading, setResetLoading] = useState(false);
const [totpEnabled, setTotpEnabled] = useState(!!user.totpEnabled);
const [exportLoading, setExportLoading] = useState(false);
const [newKeyName, setNewKeyName] = useState("");
const [newKeyLoading, setNewKeyLoading] = useState(false);
@@ -292,17 +289,6 @@ export function AdminUserManagePanel({
}
}
async function handleDisableTotp() {
try {
await adminDisableUserTotp(user.id);
setTotpEnabled(false);
onTotpDisabled();
toast.success(t("admin.totpDisabledSuccess"));
} catch (e) {
toast.error(apiErrorMessage(e, t("admin.totpDisableFailed")));
}
}
async function handleExport() {
setExportLoading(true);
try {
@@ -556,36 +542,6 @@ export function AdminUserManagePanel({
)}
</div>
{/* TOTP */}
<div className="flex flex-col gap-2">
{sectionHeading(t("admin.totpSectionTitle"))}
<div className="flex items-center justify-between">
<span className="text-xs text-muted-foreground">
{totpEnabled
? t("admin.totpStatusEnabled")
: t("admin.totpStatusDisabled")}
</span>
{totpEnabled && (
<Button
variant="outline"
size="sm"
className="h-7 text-[10px] border-destructive/40 text-destructive hover:bg-destructive/10 hover:text-destructive"
onClick={() =>
setConfirmDialog({
message: t("admin.disableTotpConfirm", {
username: user.username,
}),
onConfirm: handleDisableTotp,
})
}
>
<ShieldOff className="size-3" />
{t("admin.disableTotp")}
</Button>
)}
</div>
</div>
<AdminSecondFactorsSection
userId={user.id}
username={user.username}
@@ -593,10 +549,7 @@ export function AdminUserManagePanel({
requestConfirm={(message, onConfirm) =>
setConfirmDialog({ message, onConfirm })
}
onReset={() => {
setTotpEnabled(false);
onTotpDisabled();
}}
onReset={onSecondFactorsReset}
/>
{/* Roles */}