1import{l as $,r as p,C as L,i as q,h as E,c as g,o,w as a,d as n,a as t,e as r,f as d,b as i,ai as H,u,F as N,g as Q,t as W,n as b,W as F}from"./app-BwPdGapu.js";import{_ as Y}from"./ActionSection-1Y7fvh3w.js";import{_ as h}from"./ConfirmsPassword-Cpeb9xmY.js";import{_ as j}from"./InputError-DrvGqcEq.js";import{_ as D}from"./InputLabel-rqi9V0iE.js";import{_ as P}from"./TextInput-Dlri1d1n.js";import{_ as w}from"./index-CVwy_t6F.js";import"./SectionTitle-B-S6-p9t.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./DialogModal-D9TxeuYn.js";import"./utils-DjqsqOe8.js";const G={key:0,class:"mb-6 rounded-lg bg-green-50 p-4 ring-1 ring-inset ring-green-600/20 dark:bg-green-500/10 dark:ring-green-400/20"},O={key:1,class:"text-lg font-medium text-zinc-900 dark:text-zinc-100"},U={key:2,class:"mb-6 rounded-lg bg-zinc-50 p-4 ring-1 ring-inset ring-zinc-500/10 dark:bg-zinc-400/10 dark:ring-zinc-400/20"},I={key:3},J={key:0},X={class:"mt-4 max-w-xl text-sm text-zinc-600 dark:text-zinc-400"},Z={key:0,class:"font-semibold"},ee={key:1},te=["innerHTML"],oe={key:0,class:"mt-4 max-w-xl text-sm text-zinc-600 dark:text-zinc-400"},ae={class:"font-semibold"},ne=["innerHTML"],se={key:1,class:"mt-4"},re={key:1},ie={class:"mt-4 grid max-w-xl gap-1 rounded-lg bg-zinc-100 px-4 py-4 font-mono text-sm dark:bg-zinc-900 dark:text-zinc-100"},le={class:"mt-5"},de={key:0},ue={key:1},_e={__name:"TwoFactorAuthenticationForm",props:{requiresConfirmation:Boolean},setup(S){const V=S,A=$(),c=p(!1),s=p(!1),m=p(!1),k=p(null),y=p(null),x=p([]),v=L({code:""}),f=q(()=>{var l;return!c.value&&((l=A.props.auth.user)==null?void 0:l.two_factor_enabled)});E(f,()=>{f.value||(v.reset(),v.clearErrors())});const B=()=>{c.value=!0,F.post(route("two-factor.enable"),{},{preserveScroll:!0,onSuccess:()=>Promise.all([M(),R(),C()]),onFinish:()=>{c.value=!1,s.value=V.requiresConfirmation}})},M=()=>axios.get(route("two-factor.qr-code")).then(l=>{k.value=l.data.svg}),R=()=>axios.get(route("two-factor.secret-key")).then(l=>{y.value=l.data.secretKey}),C=()=>axios.get(route("two-factor.recovery-codes")).then(l=>{x.value=l.data}),z=()=>{v.post(route("two-factor.confirm"),{errorBag:"confirmTwoFactorAuthentication",preserveScroll:!0,preserveState:!0,onSuccess:()=>{s.value=!1,k.value=null,y.value=null}})},K=()=>{axios.post(route("two-factor.recovery-codes")).then(()=>C())},T=()=>{m.value=!0,F.delete(route("two-factor.disable"),{preserveScroll:!0,onSuccess:()=>{m.value=!1,s.value=!1}})};return(l,e)=>(o(),g(Y,null,{title:a(()=>e[1]||(e[1]=[d(" Two Factor Authentication ")])),description:a(()=>e[2]||(e[2]=[d(" Add additional security to your account using two factor authentication. ")])),content:a(()=>[f.value&&!s.value?(o(),n("div",G,e[3]||(e[3]=[t("div",{class:"flex"},[t("div",{class:"flex-shrink-0 text-green-500 dark:text-green-400"},[t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-shield-check"},[t("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}),t("path",{d:"m9 12 2 2 4-4"})])]),t("div",{class:"ml-3"},[t("div",{class:"text-sm text-green-500 dark:text-green-400"},[t("p",null,"You have enabled two factor authentication.")])])],-1)]))):f.value&&s.value?(o(),n("h3",O," Finish enabling two factor authentication. ")):(o(),n("div",U,e[4]||(e[4]=[t("div",{class:"flex"},[t("div",{class:"flex-shrink-0 text-zinc-500 dark:text-zinc-400"},[t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[t("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}),t("path",{d:"M12 8v4"}),t("path",{d:"M12 16h.01"})])]),t("div",{class:"ml-3"},[t("div",{class:"text-sm text-zinc-600 dark:text-zinc-400"},[t("p",null,"You have not enabled two factor authentication.")])])],-1)]))),e[13]||(e[13]=t("div",{class:"mt-3 max-w-xl text-sm text-zinc-600 dark:text-zinc-400"},[t("p",null," When two factor authentication is enabled, you will be prompted for a secure, random token during authentication. You may retrieve this token from your phone's Google Authenticator application. ")],-1)),f.value?(o(),n("div",I,[k.value?(o(),n("div",J,[t("div",X,[s.value?(o(),n("p",Z," To finish enabling two factor authentication, scan the following QR code using your phone's authenticator application or enter the setup key and provide the generated OTP code. ")):(o(),n("p",ee," Two factor authentication is now enabled. Scan the following QR code using your phone's authenticator application or enter the setup key. "))]),t("div",{class:"mt-4 inline-block bg-white p-2",innerHTML:k.value}
1,null,8,te),y.value?(o(),n("div",oe,[t("p",ae,[e[5]||(e[5]=d("Setup Key: ")),t("span",{innerHTML:y.value},null,8,ne)])])):r("",!0),s.value?(o(),n("div",se,[i(D,{for:"code",value:"Code"}),i(P,{id:"code",modelValue:u(v).code,"onUpdate:modelValue":e[0]||(e[0]=_=>u(v).code=_),type:"text",name:"code",class:"mt-1 block w-1/2",inputmode:"numeric",autofocus:"",autocomplete:"one-time-code",onKeyup:H(z,["enter"])},null,8,["modelValue"]),i(j,{message:u(v).errors.code,class:"mt-2"},null,8,["message"])])):r("",!0)])):r("",!0),x.value.length>0&&!s.value?(o(),n("div",re,[e[6]||(e[6]=t("div",{class:"mt-4 max-w-xl text-sm text-zinc-600 dark:text-zinc-400"},[t("p",{class:"font-semibold"}," Store these recovery codes in a secure password manager. They can be used to recover access to your account if your two factor authentication device is lost. ")],-1)),t("div",ie,[(o(!0),n(N,null,Q(x.value,_=>(o(),n("div",{key:_},W(_),1))),128))])])):r("",!0)])):r("",!0),t("div",le,[f.value?(o(),n("div",ue,[i(h,{onConfirmed:z},{default:a(()=>[s.value?(o(),g(u(w),{key:0,class:b(["me-3",{"opacity-25":c.value}]),disabled:c.value},{default:a(()=>e[8]||(e[8]=[d(" Confirm ")])),_:1},8,["class","disabled"])):r("",!0)]),_:1}),i(h,{onConfirmed:K},{default:a(()=>[x.value.length>0&&!s.value?(o(),g(u(w),{key:0,variant:"outline",class:"me-3"},{default:a(()=>e[9]||(e[9]=[d(" Regenerate Recovery Codes ")])),_:1})):r("",!0)]),_:1}),i(h,{onConfirmed:C},{default:a(()=>[x.value.length===0&&!s.value?(o(),g(u(w),{key:0,variant:"outline",class:"me-3"},{default:a(()=>e[10]||(e[10]=[d(" Show Recovery Codes ")])),_:1})):r("",!0)]),_:1}),i(h,{onConfirmed:T},{default:a(()=>[s.value?(o(),g(u(w),{key:0,variant:"outline",class:b({"opacity-25":m.value}),disabled:m.value},{default:a(()=>e[11]||(e[11]=[d(" Cancel ")])),_:1},8,["class","disabled"])):r("",!0)]),_:1}),i(h,{onConfirmed:T},{default:a(()=>[s.value?r("",!0):(o(),g(u(w),{key:0,variant:"destructive",class:b({"opacity-25":m.value}),disabled:m.value},{default:a(()=>e[12]||(e[12]=[d(" Disable ")])),_:1},8,["class","disabled"]))]),_:1})])):(o(),n("div",de,[i(h,{onConfirmed:B},{default:a(()=>[i(u(w),{variant:"outline",class:b({"opacity-25":c.value}),disabled:c.value},{default:a(()=>e[7]||(e[7]=[d(" Enable ")])),_:1},8,["class","disabled"])]),_:1})]))])]),_:1}))}};export{_e 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.