1import{u as N,b as z,a as R,c as v,r as g,o as A,e as n,f as p,g as r,h as F,i as o,_ as L,j as M,t as s,F as h,m as y,w as P,p as $,v as q,k as D,x as O,y as J,z as U,n as G,A as H,C as K,D as l}from"./index-HRqdy4hL.js";import{u as Q}from"./usePageTheme-BuGa2xVV.js";const W={key:0,class:"absolute inset-0 auth-overlay"},X={class:"space-y-8 relative z-10 auth-card"},Y={class:"text-center"},Z={class:"mt-6 text-2xl font-semibold auth-heading"},ee={class:"mt-2 text-sm auth-helper"},te={key:0,role:"alert","aria-live":"assertive",class:"rounded-md bg-red-500/10 border border-red-500/20 p-4 text-sm text-red-400"},oe={key:1,role:"status","aria-live":"polite",class:"rounded-md bg-emerald-500/10 border border-emerald-500/20 p-4 text-sm text-emerald-300"},ae={for:"code",class:"block text-sm font-medium auth-label"},se=["disabled","aria-busy"],re={class:"text-center text-sm"},ue={__name:"VerifyEmail",setup(le){const{t}=N(),I=K(),b=U(),d=z(),m=R(),{pageVars:T}=Q("login"),_=v(()=>d.files?.logo_userpanel_login||null),B=v(()=>d.cdnFallback(d.files?.logo_userpanel_login)),k=v(()=>d.files?.background_loginpage||null),j=v(()=>d.cdnFallback(k.value)),E=v(()=>{const i=k.value,a=j.value;if(!i&&!a)return{};const u=[];return i&&u.push(`url(${i})`),a&&a!==i&&u.push(`url(${a})`),{backgroundImage:u.join(", "),backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundAttachment:"fixed"}}),c=g(""),S=g(""),e=g("idle"),f=g(""),w=g(null);function x(){G(()=>w.value?.focus())}async function V(){if(e.value!=="loading"){e.value="loading",f.value="";try{const a=await fetch("/api/signup/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:S.value||void 0,code:c.value})}),u=await a.json().catch(()=>({}));if(!a.ok){e.value="error",f.value=u.message||t("verify.failed","Verification failed."),x();return}e.value="success",m.clearImpersonationState?.(),m.token=null,m.user=null,m.modules={},m.memberships=[],localStorage.removeItem("token"),localStorage.removeItem("refresh_token"),setTimeout(()=>I.push("/login"),1500)}catch{e.value="error",f.value=t("auth.network_error","Network error. Please try again."),x()}}}return A(()=>{c.value=String(b.params.code||b.query.code||""),S.value=String(b.query.email||"").replace(/ /g,"+"),c.value?V():x()}),(i,a)=>{const u=H("router-link");return l(),n("main",{class:"min-h-screen flex items-center justify-center auth-page-bg px-4 py-12 sm:px-6 lg:px-8 relative",style:J([E.value,o(T)])},[k.value?(l(),n("div",W)):p("",!0),r("div",X,[r("div",Y,[_.value?(l(),F(L,{key:0,src:_.value,fallback:B.value,alt:o(t)("global.logo","Logo"),class:"mx-auto w-auto mb-4"},null,8,["src","fallback","alt"])):p("",!0),r("h1",{class:M(_.value?"sr-only":"text-3xl font-bold auth-heading")},s(o(t)("login.title","AdServer")),3),r("h2",Z,s(o(t)("verify.title","Verify your email")),1),r("p",ee,[e.value==="loading"?(l(),n(h,{key:0},[y(s(o(t)("verify.working","Verifyingâ¦")),1)],64)):e.value==="success"?(l(),n(h,{key:1},[y(s(o(t)("verify.success","Email verified! Redirecting to loginâ¦")),1)],64)):e.value==="error"?(l(),n(h,{key:2},[y(s(o(t)("verify.need_code","Enter the code from your verification email.")),1)],64)):(l(),n(h,{key:3},[y(s(o(t)("verify.need_code","Enter the code from your verification email.")),1)],64))])]),e.value==="error"?(l(),n("div",te,s(f.value),1)):p("",!0),e.value==="success"?(l(),n("div",oe,s(o(t)("verify.success","Email verified! Redirecting to loginâ¦")),1)):p("",!0),e.value!=="success"?(l(),n("form",{key:2,class:"mt-8 space-y-6",onSubmit:P(V,["prevent"])},[r("div",null,[r("label",ae,s(o(t)("verify.code","Verification code")),1),$(r("input",{id:"code",ref_key:"codeInput",ref:w,"onUpdate:modelValue":a[0]||(a[0]=C=>c.value=C),type:"text",required:"",autocomplete:"one-time-code",class:"mt-1 auth-input shadow-sm focus:outline-none focus:ring-1 focus:ring-primary sm:text-sm font-mono",placeholder:"abc123â¦",onInput:a[1]||(a[1]=C=>{e.value==="error"&&(e.value="idle",f.value="")})},null,544),[[q,c.value]])]),r("button",{type:"submit",disabled:e.value==="loading"||!c.value,"aria-busy":e.value==="loading",class:"auth-button w-full flex justify-center text-sm font-semibold shadow-sm focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"},s(e.value==="loading"?o(t)("global.loading","Loading..."):o(t)("verify.submit","Verify")),9,se),r("div",re,[D(u,{to:"/login",class:"font-medium auth-link"},{default:O(()=>[y(s(o(t)("auth.back_to_login","Back to login")),1)]),_:1})])],32)):p("",!0)])],4)}}};export{ue 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.