"use client" import { OrgSettingsSection } from "@/components/admin/settings/org-settings-form" import { SettingsCard, SettingsCheckboxRow, SettingsField, SettingsGrid, SettingsToggleRow, } from "@/components/settings/settings-kit" import { AutomationTabMasonry } from "@/components/gmail/settings/automation/automation-tab-masonry" import { useOrgSettingsStore } from "@/lib/admin-settings/org-settings-store" import { Input } from "@/components/ui/input" const METHODS = [ { id: "totp" as const, label: "Application TOTP" }, { id: "webauthn" as const, label: "Clés de sécurité (WebAuthn)" }, ] export function SecuritySection() { const twoFactor = useOrgSettingsStore((s) => s.twoFactor) const setTwoFactor = useOrgSettingsStore((s) => s.setTwoFactor) function toggleMethod(id: (typeof METHODS)[number]["id"], checked: boolean) { const methods = checked ? [...new Set([...twoFactor.allowed_methods, id])] : twoFactor.allowed_methods.filter((m) => m !== id) setTwoFactor({ allowed_methods: methods }) } return ( setTwoFactor({ required_for_all })} /> setTwoFactor({ required_for_admins })} /> {METHODS.map((method) => ( toggleMethod(method.id, v)} /> ))} setTwoFactor({ grace_period_days: Number(e.target.value) || 0 }) } /> setTwoFactor({ remember_device_days: Number(e.target.value) || 0 }) } /> ) }