{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "authentication-18",
  "type": "registry:block",
  "description": "Security settings with two-factor and alert switches above an active sessions device table.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "button",
    "switch"
  ],
  "files": [
    {
      "path": "registry/designali/blocks/authentication/authentication-18.tsx",
      "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport {\n  FingerprintPattern as Fingerprint,\n  Globe,\n  KeyRound,\n  Laptop,\n  ShieldCheck,\n  Smartphone,\n  Tablet,\n} from \"@designali/icons\"\n\nimport { Button } from \"@workspace/ui/components/button\"\nimport { Switch } from \"@workspace/ui/components/switch\"\n\nconst initialSessions = [\n  { id: 1, icon: Laptop, device: \"Chrome on macOS\", location: \"Toronto, CA\", ip: \"142.112.8.20\", seen: \"Active now\", current: true },\n  { id: 2, icon: Smartphone, device: \"Designali app on iPhone\", location: \"Toronto, CA\", ip: \"142.112.8.41\", seen: \"2 hours ago\", current: false },\n  { id: 3, icon: Tablet, device: \"Safari on iPad\", location: \"Montreal, CA\", ip: \"70.81.3.112\", seen: \"4 days ago\", current: false },\n  { id: 4, icon: Globe, device: \"Firefox on Windows\", location: \"Lisbon, PT\", ip: \"85.240.19.7\", seen: \"12 days ago\", current: false },\n]\n\nexport default function Authentication18() {\n  const [sessions, setSessions] = useState(initialSessions)\n  const [twoFactor, setTwoFactor] = useState(true)\n  const [alerts, setAlerts] = useState(true)\n\n  const others = sessions.filter((session) => !session.current).length\n\n  return (\n    <section className=\"w-full bg-background py-16 md:py-24\">\n      <div className=\"mx-auto max-w-5xl px-6\">\n        <div className=\"flex flex-col gap-2 border-b pb-6 md:flex-row md:items-end md:justify-between\">\n          <div>\n            <p className=\"text-sm text-muted-foreground\">Settings / Security</p>\n            <h2 className=\"mt-1 text-3xl font-semibold tracking-tight\">Sign-in and security</h2>\n          </div>\n          <p className=\"flex items-center gap-2 text-sm text-chart-3 dark:text-primary\">\n            <ShieldCheck className=\"size-4\" />\n            Security checkup complete\n          </p>\n        </div>\n\n        <div className=\"grid gap-px border-b bg-border sm:grid-cols-3\">\n          {[\n            { icon: KeyRound, title: \"Password\", value: \"Changed 3 months ago\", action: \"Change\" },\n            { icon: Fingerprint, title: \"Passkeys\", value: \"2 registered\", action: \"Manage\" },\n            { icon: ShieldCheck, title: \"Recovery codes\", value: \"8 of 10 remaining\", action: \"View\" },\n          ].map((item) => (\n            <div key={item.title} className=\"flex items-start gap-3 bg-background py-6 sm:px-6 sm:first:ps-0\">\n              <item.icon className=\"mt-0.5 size-4 shrink-0 text-muted-foreground\" />\n              <div className=\"flex-1\">\n                <p className=\"text-sm font-medium\">{item.title}</p>\n                <p className=\"text-sm text-muted-foreground\">{item.value}</p>\n              </div>\n              <a href=\"#\" className=\"text-sm underline underline-offset-4\">{item.action}</a>\n            </div>\n          ))}\n        </div>\n\n        <div className=\"divide-y border-b\">\n          <label className=\"flex items-center justify-between gap-6 py-5\">\n            <span>\n              <span className=\"block text-sm font-medium\">Require two-factor authentication</span>\n              <span className=\"block text-sm text-muted-foreground\">Ask for an authenticator code on new devices.</span>\n            </span>\n            <Switch checked={twoFactor} onCheckedChange={setTwoFactor} />\n          </label>\n          <label className=\"flex items-center justify-between gap-6 py-5\">\n            <span>\n              <span className=\"block text-sm font-medium\">Email me about new sign-ins</span>\n              <span className=\"block text-sm text-muted-foreground\">Get an alert when a device we don&apos;t recognize signs in.</span>\n            </span>\n            <Switch checked={alerts} onCheckedChange={setAlerts} />\n          </label>\n        </div>\n\n        <div className=\"mt-10 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n          <div>\n            <h3 className=\"font-medium\">Where you&apos;re signed in</h3>\n            <p className=\"text-sm text-muted-foreground\">{sessions.length} active sessions</p>\n          </div>\n          <Button\n            variant=\"outline\"\n            disabled={others === 0}\n            onClick={() => setSessions(sessions.filter((session) => session.current))}\n          >\n            Sign out of {others} other {others === 1 ? \"session\" : \"sessions\"}\n          </Button>\n        </div>\n\n        <div className=\"mt-4 overflow-x-auto border\">\n          <table className=\"w-full min-w-[560px] text-sm\">\n            <thead className=\"bg-muted/50 text-start text-xs text-muted-foreground\">\n              <tr>\n                <th className=\"p-3 text-start font-medium\">Device</th>\n                <th className=\"p-3 text-start font-medium\">Location</th>\n                <th className=\"p-3 text-start font-medium\">Last active</th>\n                <th className=\"p-3\" />\n              </tr>\n            </thead>\n            <tbody className=\"divide-y\">\n              {sessions.map((session) => (\n                <tr key={session.id}>\n                  <td className=\"p-3\">\n                    <span className=\"flex items-center gap-3\">\n                      <session.icon className=\"size-4 text-muted-foreground\" />\n                      <span>\n                        {session.device}\n                        {session.current && (\n                          <span className=\"ms-2 border px-1.5 text-[10px] text-muted-foreground uppercase\">This device</span>\n                        )}\n                      </span>\n                    </span>\n                  </td>\n                  <td className=\"p-3 text-muted-foreground\">\n                    {session.location}\n                    <span className=\"block font-sans text-xs\">{session.ip}</span>\n                  </td>\n                  <td className=\"p-3 text-muted-foreground\">{session.seen}</td>\n                  <td className=\"p-3 text-end\">\n                    {!session.current && (\n                      <button\n                        type=\"button\"\n                        onClick={() => setSessions(sessions.filter((item) => item.id !== session.id))}\n                        className=\"text-sm text-destructive hover:underline dark:text-destructive\"\n                      >\n                        Revoke\n                      </button>\n                    )}\n                  </td>\n                </tr>\n              ))}\n            </tbody>\n          </table>\n        </div>\n      </div>\n    </section>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "iframeHeight": "750px"
  },
  "categories": [
    "authentication"
  ]
}