1import{f as e,l as t,v as a,w as s,x as o,y as r}from"./app-BwiOD-xT.js";import{_ as l}from"./SettingsHeader-D_yAUxyG.js";import{aD as n,r as i,c,o as d,p as u,x as _,u as p,q as m,y as f,w as v,z as b,N as g,a as h}from"./vendor-eWDfdwlh.js";import{s as y}from"./axiosErrors-BLKeM6QF.js";import{s as w}from"./useSafeHtml-Cthc_4r3.js";/* empty css */import"./media-vendor-aRMZHiv3.js";const x={class:"block bg-background sm:rounded-lg pb-2 w-full"},j={key:0,class:"p-6"},k={class:"mt-4 text-sm text-foreground"},S={class:"flex flex-col items-center gap-1 mt-4 text-sm border border-border rounded-lg p-2"},A=["innerHTML"],O={class:"flex items-center gap-x-1 mt-4 text-sm"},E={class:"flex items-center gap-4 mt-5"},T={key:1,class:"p-6"},V={class:"flex items-center gap-4 mt-5"},q={layout:e},F=Object.assign(q,{__name:"TwoFactorAuth",props:{user:Object,qr_code:String,secretKey:String},setup(e){const q=e,F=n({otp_code:""}),H=n({}),D=i(!1),K=c(()=>!!F.otp_code),L=async()=>{if(!D.value){D.value=!0,Object.keys(H).forEach(e=>delete H[e]);try{await h.post(route("user.settings.tfa.activate",q.user),{...F}),F.otp_code="",window.location.reload()}catch(e){e.response?.data?.errors&&Object.assign(H,e.response.data.errors),y(e,t("Failed to activate"))}finally{D.value=!1}}},M=async()=>{if(!D.value){D.value=!0,Object.keys(H).forEach(e=>delete H[e]);try{await h.post(route("user.settings.tfa.deactivate",q.user),{...F}),F.otp_code="",window.location.reload()}catch(e){e.response?.data?.errors&&Object.assign(H,e.response.data.errors),y(e,t("Failed to deactivate"))}finally{D.value=!1}}};return(n,i)=>{const c=l,h=a,y=s,q=o,Q=r;return d(),u("div",x,[_(c,{user:e.user,title:("__"in n?n.__:p(t))("Two Factor Authentication")},null,8,["user","title"]),e.user.is2faEnabled?(d(),u("section",T,[m("h2",null,f(("__"in n?n.__:p(t))("Deactivate two factor authentication")),1),m("form",{onSubmit:g(M,["prevent"]),class:"mt-5"},[_(h,null,{default:v(()=>[b(f(("__"in n?n.__:p(t))("Enter the code from the Authenticator app")),1)]),_:1}),_(y,{modelValue:F.otp_code,"onUpdate:modelValue":i[1]||(i[1]=e=>F.otp_code=e)},null,8,["modelValue"]),_(q,{class:"mt-1",message:H.otp_code},null,8,["message"]),m("div",V,[_(Q,{type:"submit",disabled:D.value||!K.value,variant:"default"},{default:v(()=>[b(f(("__"in n?n.__:p(t))("Deactivate")),1)]),_:1},8,["disabled"])])],32)])):(d(),u("section",j,[m("h2",null,f(("__"in n?n.__:p(t))("Activate two factor authentication")),1),m("p",k,f(("__"in n?n.__:p(t))("To finish enabling two factor authentication, scan the QR code below or use setup key on your Google Authenticator app to add your account or enter the setup key and provide the generated OTP code.")),1),m("div",S,[m("h2",null,f(("__"in n?n.__:p(t))("Scan the QR code")),1),m("div",{innerHTML:p(w)(e.qr_code),class:"inline-block bg-white"},null,8,A),m("div",O,[m("span",null,f(("__"in n?n.__:p(t))("Secret key:")),1),m("span",null,f(e.secretKey),1)])]),m("form",{onSubmit:g(L,["prevent"]),class:"mt-5"},[_(h,null,{default:v(()=>[b(f(("__"in n?n.__:p(t))("Enter the code from the Authenticator app")),1)]),_:1}),_(y,{modelValue:F.otp_code,"onUpdate:modelValue":i[0]||(i[0]=e=>F.otp_code=e)},null,8,["modelValue"]),_(q,{class:"mt-1",message:H.otp_code},null,8,["message"]),m("div",E,[_(Q,{type:"submit",disabled:D.value||!K.value,variant:"default"},{default:v(()=>[b(f(("__"in n?n.__:p(t))("Activate")),1)]),_:1},8,["disabled"])])],32)]))])}}});export{F as default}; 2//# sourceMappingURL=TwoFactorAuth-yGmeWmKV.js.map
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.