PageSourceSearch

https://livingtokens.com/assets/Manage2FABackupCodes-niPi-P8W-v4.js

js livingtokens.com collected 2026-10-02 01:36:29 UTC 5,737 bytes, 8 lines download raw bytes

1import{aM as x,j as e}from"./index-OosC7O28-v4.js";import{r}from"./react-vendor-Muxl3iU2-v4.js";import{Q as l}from"./ui-vendor-Bt0bJPpm-v4.js";import"./swiper-vendor-CLjMzi4o-v4.js";import"./framer-motion-DbzRPpXx-v4.js";const B=()=>{const[d,i]=r.useState(!1),[a,b]=r.useState(null),[n,p]=r.useState([]),[u,g]=r.useState(!1);r.useEffect(()=>{m()},[]);const m=async()=>{try{const s=await x.getBackupCodesStatus();b(s)}catch(s){console.error("Failed to fetch backup codes status:",s)}},h=async()=>{var s,t;if(window.confirm("This will invalidate any existing backup codes. Are you sure?")){i(!0);try{const o=await x.generateBackupCodes();p(o.backup_codes),g(!0),await m(),l.success("Backup codes generated successfully")}catch(o){l.error(((t=(s=o.response)==null?void 0:s.data)==null?void 0:t.message)||"Failed to generate backup codes")}finally{i(!1)}}},j=()=>{const s=n.map((f,k)=>`${k+1}. ${f}`).join(`
2`),t=new Blob([`Living Tokens 2FA Backup Codes
3Generated: ${new Date().toLocaleString()}
4
5${s}
6
7Keep these codes in a safe place. Each code can only be used once.`],{type:"text/plain"}),o=URL.createObjectURL(t),c=document.createElement("a");c.href=o,c.download=`livingtokens-backup-codes-${Date.now()}.txt`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(o)},y=()=>{const s=n.join(`
8`);navigator.clipboard.writeText(s),l.success("All backup codes copied to clipboard")};return e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-3xl font-display font-bold mb-2",children:"2FA Backup Codes"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Backup codes allow you to access your account if you lose your authenticator device"})]}),e.jsxs("div",{className:"card p-6 mb-6",children:[e.jsx("h2",{className:"text-xl font-display font-semibold mb-4",children:"Status"}),a&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 dark:bg-gray-800 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"2FA Enabled"}),e.jsx("p",{className:"text-lg font-semibold",children:a.google2fa_enabled?"✓ Yes":"✗ No"})]}),!a.google2fa_enabled&&e.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:"Enable 2FA first before generating backup codes"})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 dark:bg-gray-800 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Remaining Backup Codes"}),e.jsxs("p",{className:"text-lg font-semibold",children:[a.remaining_codes," codes"]})]}),a.remaining_codes===0&&a.google2fa_enabled&&e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:"Generate new codes to avoid lockout"}),a.remaining_codes>0&&a.remaining_codes<=3&&e.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:"Low on backup codes - consider generating new ones"})]})]}),e.jsx("button",{onClick:h,disabled:d||!(a!=null&&a.google2fa_enabled),className:"mt-6 btn-primary disabled:opacity-50 disabled:cursor-not-allowed",children:d?"Generating...":"Generate New Backup Codes"})]}),u&&n.length>0&&e.jsxs("div",{className:"card p-6 border-2 border-amber-500",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("span",{className:"text-2xl",children:"⚠️"}),e.jsx("h2",{className:"text-xl font-display font-semibold text-amber-600 dark:text-amber-400",children:"Important: Save These Codes Now"})]}),e.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4 mb-6",children:e.jsxs("ul",{className:"text-sm text-amber-800 dark:text-amber-200 space-y-1",children:[e.jsx("li",{children:"• Each backup code can only be used once"}),e.jsx("li",{children:"• Store them in a secure place (password manager, safe, etc.)"}),e.jsx("li",{children:"• You won't be able to see these codes again"}),e.jsx("li",{children:"• Use them to log in if you lose access to your authenticator app"})]})}),e.jsx("div",{className:"grid grid-cols-2 gap-3 mb-6",children:n.map((s,t)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 rounded-lg font-mono",children:[e.jsx("span",{className:"text-lg font-semibold",children:s}),e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(s),l.success(`Code ${t+1} copied`)},className:"text-sm text-primary-500 hover:text-primary-600",children:"Copy"})]},t))}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:j,className:"flex-1 btn-secondary",children:"📥 Download as Text File"}),e.jsx("button",{onClick:y,className:"flex-1 btn-secondary",children:"📋 Copy All Codes"})]})]}),e.jsxs("div",{className:"card p-6 mt-6 bg-blue-50 dark:bg-blue-900/20",children:[e.jsxs("h3",{className:"text-lg font-semibold mb-3 flex items-center gap-2",children:[e.jsx("span",{children:"ℹ️"}),"How to Use Backup Codes"]}),e.jsxs("ol",{className:"space-y-2 text-sm text-gray-700 dark:text-gray-300",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"1."}),` When logging in, if you can't access your authenticator app, click "Lost your device? Use backup code"`]}
8),e.jsxs("li",{children:[e.jsx("strong",{children:"2."})," Enter one of your backup codes (8 characters)"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"3."})," That backup code will be marked as used and won't work again"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"4."})," Generate new codes when you're running low (3 or fewer remaining)"]})]})]})]})};export{B as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.