1import{W as he,_ as be}from"./LayoutHeader.78123080.js";import{N as xe}from"./nuxt-link.db37c400.js";import{l as o,X as we,ao as Ae,r as p,e as Ce,w as ee,g as T,S as Fe,h as B,j as h,k as b,m as s,n as l,q as i,F as M,G as u,p as f,B as z,z as D,x as g,v as I,ab as te,y as se,_ as ke,A as Oe,Q as Se}from"./entry.127b5071.js";import{_ as Pe}from"./InputOTP.1b77cd07.js";import{_ as Me}from"./OtpVerificationModal.ad8d94d0.js";import"./helpers.ad6c1d27.js";import"./en-US.f27c06e2.js";import"./useResendCooldown.ae9c1cea.js";import"./global.eea9a2ae.js";import"./UserOutlined.aeb04cb2.js";var Ee={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M744 62H280c-35.3 0-64 28.7-64 64v768c0 35.3 28.7 64 64 64h464c35.3 0 64-28.7 64-64V126c0-35.3-28.7-64-64-64zm-8 824H288V134h448v752zM472 784a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"mobile",theme:"outlined"};const Le=Ee;function oe(y){for(var c=1;c<arguments.length;c++){var d=arguments[c]!=null?Object(arguments[c]):{},m=Object.keys(d);typeof Object.getOwnPropertySymbols=="function"&&(m=m.concat(Object.getOwnPropertySymbols(d).filter(function(v){return Object.getOwnPropertyDescriptor(d,v).enumerable}))),m.forEach(function(v){je(y,v,d[v])})}return y}function je(y,c,d){return c in y?Object.defineProperty(y,c,{value:d,enumerable:!0,configurable:!0,writable:!0}):y[c]=d,y}var V=function(c,d){var m=oe({},c,d.attrs);return o(we,oe({},m,{icon:Le}),null)};V.displayName="MobileOutlined";V.inheritAttrs=!1;const $e=V,Qe=""+globalThis.__publicAssetsURL("assets/images/secure.svg");const Te={class:"ant-layout-slot multifactor-authentication-page"},ze={class:"page-wrapper"},Ie={class:"column-left"},qe=s("div",{class:"title"},"Two-Factor Authentication (2FA)",-1),Re=s("div",{style:{"font-size":"12px"}},"Protect your account with an additional layer of security",-1),Ue={class:"d-flex",style:{"align-items":"center"}},Ne={style:{"margin-right":"6px","line-height":"16px"}},Be=s("div",null,[s("div",{class:"label"},[g(" Authenticator App Setup "),s("img",{src:Qe})]),s("div",{style:{"font-size":"10px"}},"Use an app on your phone to generate authentication codes.")],-1),De={class:""},Ve={class:"text-center mt-4"},He=s("p",null,"If you don't have an authenticator app, download Google Authenticator.",-1),Ke={class:"text-center"},Ge=["src"],We={style:{border:"1px solid #efefef",padding:"10px","border-radius":"8px"}},Xe={class:"d-flex",style:{"align-items":"center"}},Ye=s("div",null,"Unable to scan? You can use the setup key to manually configure your authenticator app.",-1),Je={key:0,style:{background:"#efefef",padding:"8px","border-radius":"8px","margin-top":"10px"}},Ze={class:"d-flex",style:{"align-items":"center","justify-content":"space-between"}},et=["value"],tt=s("div",{class:"mt-3"},[s("ul",null,[s("li",null,"Open Authenticator App"),s("li",null,"Scan the QR code to add a new token"),s("li",null,"Enter the OTP generated by the app")])],-1),st=s("p",{style:{"font-size":"16px","font-weight":"600",color:"#4291c0","margin-bottom":"8px"}},"OTP (One Time Password)",-1),ot={class:"text-center mt-4"},lt={class:""},nt={style:{"font-size":"16px",color:"#ea4d4d"}},at={style:{background:"#efefef",padding:"8px","border-radius":"8px","margin-top":"10px",width:"100%",overflow:"hidden"}},rt={class:"item-recovery-code",style:{"font-weight":"600","font-size":"16px"}},it={class:"text-center mt-4"},ht={__name:"multifactor-authentication",setup(y){const c=Ae.useBreakpoint(),d=p(null),m=p(!1),v=p(!1),x=p(!1),E=p(!1),L=p(!1),w=p(),A=p(),C=p(),F=p(""),j=p(""),q=p(),R=Ce(()=>F.value.length===6);ee([()=>m.value,()=>x.value],([t,e],[r,n])=>{t&&t!==r&&(A.value=null),e&&e!==n&&(F.value="",Se(()=>{d.value&&d.value.focusFirstInput()}))},{immediate:!0});const le=T` 2 query InitMe { 3 me { 4 twoFactorConfirmedAt 5 } 6 } 7`,{result:S,loading:ne,refetch:H}=Fe(le,null,{fetchPolicy:"no-cache"});ee(()=>S.value,()=>{var t,e;(e=(t=S.value)==null?void 0:t.me)!=null&&e.twoFactorConfirmedAt&&(C.value=!0)},{deep:!0});const ae=T` 8 mutation setup2FA($password: String!, $otp: String) { 9 setup2FA(password: $password, otp: $otp) { 10 qrCodeInline 11 secret 12 } 13 } 14`,{mutate:K,loading:$}=B(ae,{fetchPolicy:"no-cache"}),re=T` 15 mutation disable2FA($input: OTPInput) { 16 disable2FA(input: $input) { 17 message 18 status 19 } 20 } 21`,{mutate:ie,loading:ue}=B(re,{fetchPolicy:"no-cache"}),G=()=>{K({password:A.value,otp:"null"}).then(({data:t})=>{w.value=t==null?void 0:t.setup2FA,m.value=!1,x.value=!0}
21).catch(t=>{var e;t!=null&&t.graphQLErrors[0].message?u.error(Object.values(t==null?void 0:t.graphQLErrors[0].message)):u.error(Object.values((e=t==null?void 0:t.graphQLErrors[0].extensions)==null?void 0:e.reason))})},ce=async t=>{j.value==="reset"?K({otp:t,password:"null"}).then(({data:e})=>{w.value=e==null?void 0:e.setup2FA,v.value=!1,x.value=!0}).catch(e=>{var r;e!=null&&e.graphQLErrors[0].message?u.error(Object.values(e==null?void 0:e.graphQLErrors[0].message)):u.error(Object.values((r=e==null?void 0:e.graphQLErrors[0].extensions)==null?void 0:r.reason))}):j.value==="disable"&&ie({input:{otp:t}}).then(({data:e})=>{var r,n,_;v.value=!1,H(),((r=e==null?void 0:e.disable2FA)==null?void 0:r.status)==="success"?u.success((n=e==null?void 0:e.disable2FA)==null?void 0:n.message):u.error((_=e==null?void 0:e.disable2FA)==null?void 0:_.message)}).catch(e=>{var r;e!=null&&e.graphQLErrors[0].message?u.error(Object.values(e==null?void 0:e.graphQLErrors[0].message)):u.error(Object.values((r=e==null?void 0:e.graphQLErrors[0].extensions)==null?void 0:r.reason))})},de=t=>{var e,r;!t&&((r=(e=S.value)==null?void 0:e.me)!=null&&r.twoFactorConfirmedAt)&&(v.value=!0,j.value="disable")},pe=()=>{C.value===!1&&(C.value=!0)},me=T` 22 mutation confirm2FA($otp: String!) { 23 confirm2FA(otp: $otp) { 24 message 25 status 26 recoveryCodes 27 } 28 } 29`,{mutate:ve,loading:U}=B(me,{fetchPolicy:"no-cache"}),W=()=>{R&&ve({otp:F.value}).then(({data:t})=>{var e,r,n,_;((e=t==null?void 0:t.confirm2FA)==null?void 0:e.status)==="success"?(u.success((r=t==null?void 0:t.confirm2FA)==null?void 0:r.message),x.value=!1,w.value=null,L.value=!0,q.value=(n=t==null?void 0:t.confirm2FA)==null?void 0:n.recoveryCodes):u.error((_=t==null?void 0:t.confirm2FA)==null?void 0:_.message)}).catch(t=>{var e;t!=null&&t.graphQLErrors[0].message?u.error(Object.values(t==null?void 0:t.graphQLErrors[0].message)):u.error(Object.values((e=t==null?void 0:t.graphQLErrors[0].extensions)==null?void 0:e.reason))})},fe=async()=>{L.value=!1;try{await H()}catch(t){console.error("Error refreshing 2FA status:",t)}},X=t=>{if(t==="recovery-code"){const n=q.value.join(` 30`);navigator.clipboard.writeText(n).then(()=>{u.success("Successfully copy")}).catch(()=>{u.error("Oops, unable to copy")})}else{let n=document.querySelector(`#${t}`);n.setAttribute("type","text"),n.select();try{var e=document.execCommand("copy"),r=e?"successful":"unsuccessful";u.success("Successfully copy")}catch{u.error("Oops, unable to copy")}n.setAttribute("type","hidden"),window.getSelection().removeAllRanges()}};return(t,e)=>{const r=be,n=h("a-col"),_=h("a-switch"),Q=h("a-row"),ge=h("a-divider"),k=h("a-button"),ye=h("a-card"),_e=h("a-input-password"),N=h("a-modal"),Y=xe;return f(),b(M,null,[o(r,{dataPage:[{to:"/security/multifactor-authentication",title:"Multifactor Authentication"}]}),s("div",Te,[s("div",ze,[o(Q,{type:"flex",gutter:24},{default:l(()=>[o(n,{xs:24,sm:24,md:24,lg:24,xl:19},{default:l(()=>[s("div",Ie,[o(ye,{bordered:!1,class:"ant-page mb-4"},{default:l(()=>[o(Q,{type:"flex",gutter:24,justify:"space-between",align:"middle"},{default:l(()=>[o(n,{xs:24,sm:18,md:18,lg:18,xl:18},{default:l(()=>[qe,Re]),_:1}),o(n,{xs:24,sm:6,md:6,lg:6,xl:6},{default:l(()=>[s("div",{class:z(i(c).xs?"mt-2":"text-end")},[o(_,{checked:C.value,"onUpdate:checked":e[0]||(e[0]=a=>C.value=a),onChange:de,"checked-children":"On","un-checked-children":"Off",loading:i(ne)},null,8,["checked","loading"])],2)]),_:1})]),_:1}),C.value?(f(),b(M,{key:0},[o(ge),o(Q,{type:"flex",gutter:24},{default:l(()=>[o(n,{xs:24,sm:18,md:18,lg:18,xl:18},{default:l(()=>[s("div",Ue,[s("div",Ne,[o(i($e),{style:{"font-size":"20px"}})]),Be])]),_:1}),o(n,{xs:24,sm:6,md:6,lg:6,xl:6},{default:l(()=>{var a,O,P;return[(a=i(S))!=null&&a.me?(f(),b("div",{key:0,class:z(i(c).xs?"mt-2":"text-end")},[((P=(O=i(S))==null?void 0:O.me)==null?void 0:P.twoFactorConfirmedAt)===null?(f(),D(k,{key:0,type:"primary",onClick:e[1]||(e[1]=()=>{m.value=!0})},{default:l(()=>[g(" Setup ")]),_:1})):(f(),D(k,{key:1,type:"primary",onClick:e[2]||(e[2]=()=>{v.value=!0,j.value="reset"})},{default:l(()=>[g(" Reset ")]),_:1}))],2)):I("",!0)]}),_:1})]),_:1})],64)):I("",!0)]),_:1})])]),_:1})]),_:1})]),o(N,{visible:m.value,"onUpdate:visible":e[4]||(e[4]=a=>
30m.value=a),title:"Enter your password",footer:null,centered:"",width:"400px",class:"modal-password",maskClosable:!1},{default:l(()=>[s("div",De,[s("div",null,[o(_e,{value:A.value,"onUpdate:value":e[3]||(e[3]=a=>A.value=a),placeholder:"Password",size:"large",onKeydown:te(G,["enter"])},null,8,["value","onKeydown"])]),s("div",Ve,[o(k,{type:"primary",onClick:G,class:z(["btn-button submit-password",A.value||i($)?"":"disabled"]),disabled:!A.value||i($),loading:i($)},{default:l(()=>[g(" Continue ")]),_:1},8,["class","disabled","loading"])])])]),_:1},8,["visible"]),o(Me,{visible:v.value,"onUpdate:visible":e[5]||(e[5]=a=>v.value=a),loading:i($)||i(ue),onSubmit:ce,onCancel:pe},null,8,["visible","loading"]),o(N,{visible:x.value,"onUpdate:visible":e[10]||(e[10]=a=>x.value=a),title:"Authenticator App Setup",footer:null,centered:"",width:"400px",class:"modal-app-setup",maskClosable:!1},{default:l(()=>{var a,O,P,J;return[s("div",null,[He,s("p",Ke,[(a=w.value)!=null&&a.qrCodeInline?(f(),b("img",{key:0,src:(O=w.value)==null?void 0:O.qrCodeInline,style:{"max-width":"400px",height:"auto",border:"8px solid #4291c0","border-radius":"20px"}},null,8,Ge)):I("",!0)]),s("div",We,[s("div",Xe,[Ye,o(Y,{onClick:e[6]||(e[6]=()=>E.value=!E.value)},{default:l(()=>[E.value?(f(),b(M,{key:1},[g("Hide")],64)):(f(),b(M,{key:0},[g("View")],64))]),_:1})]),E.value?(f(),b("div",Je,[s("div",Ze,[s("div",null,se((P=w.value)==null?void 0:P.secret),1),s("input",{type:"hidden",id:"key-secret",value:(J=w.value)==null?void 0:J.secret},null,8,et),o(Y,{title:"Copy",onClick:e[7]||(e[7]=Z=>X("key-secret"))},{default:l(()=>[o(i(ke))]),_:1})])])):I("",!0)]),tt,s("div",null,[st,s("div",null,[o(Pe,{otp:F.value,"onUpdate:otp":e[8]||(e[8]=Z=>F.value=Z),ref_key:"otpRef",ref:d,data:F.value,onKeydown:te(W,["enter"])},null,8,["otp","data","onKeydown"])])]),s("div",ot,[o(k,{type:"default",class:"btn-button",onClick:e[9]||(e[9]=()=>x.value=!1)},{default:l(()=>[g("Cancel")]),_:1}),o(k,{type:"primary",class:z(["btn-button ms-2 btn-enable",!i(R)||i(U)?"disabled":""]),onClick:W,disabled:!i(R)||i(U),loading:i(U)},{default:l(()=>[g(" Enable ")]),_:1},8,["class","disabled","loading"])])])]}),_:1},8,["visible"]),o(N,{visible:L.value,"onUpdate:visible":e[12]||(e[12]=a=>L.value=a),title:"List recovery codes",footer:null,centered:"",width:"800px",class:"modal-otp",maskClosable:!1,onCancel:fe},{default:l(()=>[s("div",lt,[s("div",null,[s("p",nt,[o(i(he)),g(" Warning: Recovery codes are shown only once. Please save them securely. ")]),o(Q,{gutter:24},{default:l(()=>[(f(!0),b(M,null,Oe(q.value,(a,O)=>(f(),D(n,{xs:24,sm:24,md:12},{default:l(()=>[s("div",at,[s("div",rt,se(a),1)])]),_:2},1024))),256))]),_:1})]),s("div",it,[o(k,{type:"primary",onClick:e[11]||(e[11]=a=>X("recovery-code")),style:{width:"100px"}},{default:l(()=>[g("Copy All")]),_:1})])])]),_:1},8,["visible"])])],64)}}};export{ht 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.