PageSourceSearch

https://www.thoushaltnotclick.com/_next/static/chunks/app/account/mfa-setup/page-8491f90f01e08e7a.js

js thoushaltnotclick.com collected 2026-09-24 14:20:31 UTC 12,380 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1603],{22710:(e,t,a)=>{Promise.resolve().then(a.bind(a,47942))},47942:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>i});var n=a(95155),s=a(12115),o=a(73321),r=a(65576),l=a(18286);function i(){let{user:e}=(0,r.A)(),t=(0,o.useRouter)(),[a,i]=(0,s.useState)("totp"),[d,c]=(0,s.useState)("loading"),[u,m]=(0,s.useState)(""),[h,x]=(0,s.useState)(""),[p,b]=(0,s.useState)(""),[v,y]=(0,s.useState)([]),[f,g]=(0,s.useState)("enter_phone"),[j,N]=(0,s.useState)(""),[S,w]=(0,s.useState)("+1"),[C,_]=(0,s.useState)(!1),[k,A]=(0,s.useState)(""),[P,R]=(0,s.useState)(""),[E,M]=(0,s.useState)(""),[U,O]=(0,s.useState)(null),[T,I]=(0,s.useState)(""),[F,D]=(0,s.useState)(!1);(0,s.useEffect)(()=>{(async()=>{try{let e=await (0,l.request)("/api/auth/mfa/setup",{method:"POST"});m(e.qr_url),x(e.secret),c("scan")}catch(e){I(e.message)}try{let e=await (0,l.request)("/api/features/me/mfa/sms/consent-text");A(e?.text||"")}catch{}})()},[]);let q=async()=>{D(!0),I("");try{let e=await (0,l.request)("/api/auth/mfa/verify-setup",{method:"POST",body:JSON.stringify({code:p})});y(e.recovery_codes||[]),c("done")}catch(e){I(e.message),b("")}D(!1)},$=async()=>{D(!0),I(""),O(null);try{let e=j.replace(/\D/g,""),t=`${S}${e}`,a=await (0,l.request)("/api/features/me/mfa/sms/start-enroll",{method:"POST",body:JSON.stringify({phone_number:t,sms_consent:C})});a?.dev_code&&O(a.dev_code),M(`${S} ••• ••• ${e.slice(-4)}`),g("enter_code")}catch(e){I(e.message||"Could not start SMS enrollment")}D(!1)},B=async()=>{D(!0),I("");try{await (0,l.request)("/api/features/me/mfa/sms/finish-enroll",{method:"POST",body:JSON.stringify({code:P})}),g("done")}catch(e){I(e.message||"Could not verify code"),R("")}D(!1)},V="done"===d?"totp":"done"===f?"sms":null;return(0,n.jsx)("div",{className:"min-h-screen bg-cream flex items-center justify-center",children:(0,n.jsxs)("div",{className:"bg-white rounded-2xl shadow-lg border border-sand p-8 max-w-md w-full mx-4",children:[(0,n.jsxs)("div",{className:"text-center mb-6",children:[(0,n.jsx)("img",{src:"/logo-icon.png",alt:"ThouShaltNotClick",className:"h-12 mx-auto mb-4"}),(0,n.jsx)("h1",{className:"text-xl font-bold text-navy",children:"Set Up Two-Factor Authentication"}),(0,n.jsx)("p",{className:"text-sm text-navy/50 mt-1",children:"An extra layer of protection for your account"})]}),T&&(0,n.jsx)("div",{className:"bg-red-50 text-red-700 px-4 py-3 rounded-lg text-sm mb-4",children:T}),V?(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("div",{className:"bg-green-50 text-green-700 px-4 py-3 rounded-lg text-sm font-semibold text-center",children:"totp"===V?"Authenticator app MFA enabled!":"SMS MFA enabled!"}),"totp"===V&&v.length>0&&(0,n.jsxs)("div",{className:"text-sm text-navy/70",children:[(0,n.jsx)("p",{className:"font-semibold text-navy mb-2",children:"Save these recovery codes:"}),(0,n.jsx)("p",{className:"text-xs text-navy/50 mb-3",children:"If you lose access to your authenticator app, use one of these codes to sign in. Each code can only be used once."}),(0,n.jsx)("div",{className:"grid grid-cols-2 gap-2 p-4 bg-cream rounded-lg border border-sand",children:v.map((e,t)=>(0,n.jsx)("code",{className:"text-center font-mono text-sm text-navy py-1",children:e},t))})]}),"sms"===V&&(0,n.jsx)("div",{className:"text-xs text-navy/60 leading-relaxed text-center",children:"You can also add an authenticator app for backup. We recommend having both — if your phone is unavailable, the app still works."}),(0,n.jsx)("button",{onClick:()=>{try{{let e=new URLSearchParams(window.location.search).get("return");if(e&&e.startsWith("/")&&!e.startsWith("//"))return void t.push(e)}}catch{}if(!e)return void t.push("/dashboard");let a=e.org_roles||[];e.is_platform_admin||e.is_support_admin?t.push("/admin/platform"):e.is_enterprise_admin?t.push("/enterprise/dashboard"):a.some(e=>["principal","it_admin"].includes(e.role))?t.push("/admin/dashboard"):"parent"===e.account_type?t.push("/parent/dashboard"):"family_primary"===e.account_type||"family_member"===e.account_type?t.push("/family/dashboard"):a.some(e=>"student"===e.role)?t.push("/student/dashboard"):a.some(e=>["teacher","staff"].includes(e.role))?t.push("/staff/dashboard"):t.push("/dashboard")},className:"w-full bg-navy text-gold py-3 rounded-lg font-bold hover:bg-navy/90 transition",children:"Continue"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex gap-2 mb-5 p-1 bg-cream rounded-lg",children:[(0,n.jsx)("button",{onClick:()=>i("totp"),className:`flex-1 py-2 text-sm font-semibold rounded-md transition ${"totp"===a?"bg-white text-navy shadow-sm":"text-navy/50 hover:text-navy"}`,children:"\uD83D\uDCF1 Authenticator App"}),(0,n.jsx)("button",{onClick:()=>i("sms"),className:`flex-1 py-2 text-sm font-semibold rounded-md transition ${"sms"===a?"bg-white text-navy shadow-sm":"text-navy/50 hover:text-navy"}`,children:"\uD83D\uDCAC Text Message"})]}),"totp"===a&&"loading"===d&&(0,n.jsx)("div",{className:"text-center py-8 text-navy/40",children:"Setting up MFA..."}),"totp"===a&&"scan"===d&&(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"text-sm text-navy/70",children:[(0,n.jsx)("p",{className:"mb-3",children:"Scan this QR code with your authenticator app (Google Authenticator, Authy, or Microsoft Authenticator):"}),(0,n.jsx)("div",{className:"flex justify-center my-4",children:u?(0,n.jsx)("img",{src:u,alt:"QR Code",className:"rounded-lg border border-sand",style:{width:200,height:200}}):(0,n.jsx)("div",{className:"text-xs text-navy/60 p-4 text-center bg-cream rounded-lg border border-sand",children:"QR code unavailable — please use the manual entry option below."})}),(0,n.jsxs)("details",{className:"text-xs text-navy/40",children:[(0,n.jsx)("summary",{className:"cursor-pointer hover:text-navy/60",children:"Can't scan? Enter this code manually:"}),(0,n.jsx)("code",{className:"block mt-2 p-2 bg-cream rounded text-center font-mono text-navy/70 break-all",children:h})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-xs font-semibold text-navy/60 mb-1",children:"Enter the 6-digit code from your app:"}),(0,n.jsx)("input",{type:"text",inputMode:"numeric",maxLength:6,value:p,onChange:e=>b(e.target.value.replace(/\D/g,"")),placeholder:"000000",className:"w-full px-4 py-3 border border-sand rounded-lg text-center text-2xl font-mono tracking-[0.5em] focus:border-gold focus:outline-none"})]}),(0,n.jsx)("button",{onClick:q,disabled:6!==p.length||F,className:"w-full bg-navy text-gold py-3 rounded-lg font-bold disabled:opacity-50 hover:bg-navy/90 transition",children:F?"Verifying...":"
1Verify & Enable Authenticator"})]}),"sms"===a&&"enter_phone"===f&&(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("div",{className:"text-sm text-navy/70",children:"We’ll text you a 6-digit code each time you sign in. Standard US/Canada numbers work; international numbers may not receive Twilio SMS reliably."}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-xs font-semibold text-navy/60 mb-1",children:"Phone number"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("select",{value:S,onChange:e=>w(e.target.value),className:"px-2 py-3 border border-sand rounded-lg font-mono text-base bg-white focus:border-gold focus:outline-none","aria-label":"Country code",children:[(0,n.jsx)("option",{value:"+1",children:"\uD83C\uDDFA\uD83C\uDDF8 +1 (US/CA)"}),(0,n.jsx)("option",{value:"+44",children:"\uD83C\uDDEC\uD83C\uDDE7 +44 (UK)"}),(0,n.jsx)("option",{value:"+353",children:"\uD83C\uDDEE\uD83C\uDDEA +353 (IE)"}),(0,n.jsx)("option",{value:"+61",children:"\uD83C\uDDE6\uD83C\uDDFA +61 (AU)"}),(0,n.jsx)("option",{value:"+64",children:"\uD83C\uDDF3\uD83C\uDDFF +64 (NZ)"}),(0,n.jsx)("option",{value:"+52",children:"\uD83C\uDDF2\uD83C\uDDFD +52 (MX)"}),(0,n.jsx)("option",{value:"+33",children:"\uD83C\uDDEB\uD83C\uDDF7 +33 (FR)"}),(0,n.jsx)("option",{value:"+49",children:"\uD83C\uDDE9\uD83C\uDDEA +49 (DE)"}),(0,n.jsx)("option",{value:"+34",children:"\uD83C\uDDEA\uD83C\uDDF8 +34 (ES)"}),(0,n.jsx)("option",{value:"+39",children:"\uD83C\uDDEE\uD83C\uDDF9 +39 (IT)"}),(0,n.jsx)("option",{value:"+55",children:"\uD83C\uDDE7\uD83C\uDDF7 +55 (BR)"}),(0,n.jsx)("option",{value:"+63",children:"\uD83C\uDDF5\uD83C\uDDED +63 (PH)"}),(0,n.jsx)("option",{value:"+91",children:"\uD83C\uDDEE\uD83C\uDDF3 +91 (IN)"})]}),(0,n.jsx)("input",{type:"tel",value:j,onChange:e=>N(e.target.value),placeholder:"555 123 4567",className:"flex-1 px-4 py-3 border border-sand rounded-lg font-mono text-base focus:border-gold focus:outline-none"})]}),(0,n.jsx)("p",{className:"text-[11px] text-navy/40 mt-1",children:"Spaces and dashes are fine — we’ll format it."})]}),(0,n.jsxs)("label",{className:"flex items-start gap-2 text-xs text-navy/70 cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:C,onChange:e=>_(e.target.checked),className:"mt-0.5"}),(0,n.jsx)("span",{children:k||(0,n.jsx)(n.Fragment,{children:"I agree to receive automated SMS verification codes from ThouShaltNotClick at the number above. Message and data rates may apply. Reply STOP to opt out at any time."})})]}),(0,n.jsx)("button",{onClick:$,disabled:!j.trim()||!C||F,className:"w-full bg-navy text-gold py-3 rounded-lg font-bold disabled:opacity-50 hover:bg-navy/90 transition",children:F?"Sending...":"Send verification code"})]}),"sms"===a&&"enter_code"===f&&(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"text-sm text-navy/70",children:["Code sent to ",(0,n.jsx)("strong",{children:E}),". Enter the 6-digit code below.",U&&(0,n.jsxs)("div",{className:"mt-2 text-xs bg-yellow-50 text-yellow-800 px-3 py-2 rounded border border-yellow-200 font-mono",children:["Dev mode — code: ",U]})]}),(0,n.jsx)("div",{children:(0,n.jsx)("input",{type:"text",inputMode:"numeric",maxLength:6,value:P,onChange:e=>R(e.target.value.replace(/\D/g,"")),placeholder:"000000",className:"w-full px-4 py-3 border border-sand rounded-lg text-center text-2xl font-mono tracking-[0.5em] focus:border-gold focus:outline-none"})}),(0,n.jsx)("button",{onClick:B,disabled:6!==P.length||F,className:"w-full bg-navy text-gold py-3 rounded-lg font-bold disabled:opacity-50 hover:bg-navy/90 transition",children:F?"Verifying...":"Verify & Enable SMS"}),(0,n.jsx)("button",{onClick:()=>{g("enter_phone"),R(""),O(null)},className:"w-full text-xs text-navy/50 hover:text-navy/70 underline",children:"Use a different phone number"})]})]})]})})}},73321:(e,t,a)=>{"use strict";var n=a(74645);a.o(n,"useParams")&&a.d(t,{useParams:function(){return n.useParams}}),a.o(n,"usePathname")&&a.d(t,{usePathname:function(){return n.usePathname}}),a.o(n,"useRouter")&&a.d(t,{useRouter:function(){return n.useRouter}}),a.o(n,"useSearchParams")&&a.d(t,{useSearchParams:function(){return n.useSearchParams}})},82849:(e,t,a)=>{"use strict";function n(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)"__proto__"!==n&&(e[n]=a[n])}return e}a.r(t),a.d(t,{default:()=>s});var s=function e(t,a){function s(e,s,o){if("u">typeof document){"number"==typeof(o=n({},a,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decode
1URIComponent).replace(/[()]/g,escape);var r="";for(var l in o)o[l]&&(r+="; "+l,!0!==o[l]&&(r+="="+o[l].split(";")[0]));return document.cookie=e+"="+t.write(s,e)+r}}return Object.create({set:s,get:function(e){if("u">typeof document&&(!arguments.length||e)){for(var a=document.cookie?document.cookie.split("; "):[],n={},s=0;s<a.length;s++){var o=a[s].split("="),r=o.slice(1).join("=");try{var l=decodeURIComponent(o[0]);if(l in n||(n[l]=t.read(r,l)),e===l)break}catch(e){}}return e?n[e]:n}},remove:function(e,t){s(e,"",n({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,n({},this.attributes,t))},withConverter:function(t){return e(n({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(a)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}},e=>{e.O(0,[8286,5576,8441,5254,7358],()=>e(e.s=22710)),_N_E=e.O()}]);

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.