1import{e as N,u as w,r as t,b as k,j as e,B as m}from"./index-_aijvlUq.js";const u="/api/v1/auth";function S(){const[x]=N(),c=w(),n=x.get("token"),[i,s]=t.useState("verifying"),[f,o]=t.useState(""),[r,h]=t.useState(""),[g,l]=t.useState(!1),[d,y]=t.useState(!1);t.useEffect(()=>{if(!n){s("error"),o("No verification token provided");return}p()},[n]);async function p(){s("verifying");try{const a=await fetch(`${u}/verify-email`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:n}),credentials:"include"}),v=await a.json();if(!a.ok){s("error"),o(v?.error?.message||"Verification failed");return}s("success"),await k.getState().loadSession(),setTimeout(()=>c("/",{replace:!0}),1500)}catch{s("error"),o("Something went wrong. Please try again.")}}async function j(){if(r){l(!0);try{await fetch(`${u}/resend-verification`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r})}),y(!0)}catch{}finally{l(!1)}}}return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 px-4",children:e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-8 max-w-md w-full text-center space-y-4",children:[i==="verifying"&&e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin motion-reduce:!animate-spin h-10 w-10 text-brand-primary mx-auto",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),e.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Verifying your email..."}),e.jsx("p",{className:"text-sm text-gray-500",children:"Just a moment."})]}),i==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-16 h-16 mx-auto bg-green-100 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"h-8 w-8 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),e.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Email verified!"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Redirecting you to get started..."})]}),i==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-16 h-16 mx-auto bg-red-100 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"h-8 w-8 text-red-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Verification failed"}),e.jsx("p",{className:"text-sm text-gray-600",children:f}),e.jsxs("div",{className:"pt-2 space-y-3",children:[e.jsx("p",{className:"text-xs text-gray-400",children:"Enter your email to get a new verification link:"}),e.jsx("input",{type:"email",value:r,onChange:a=>h(a.target.value),placeholder:"[email protected]",className:"w-full text-sm border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-brand-primary"}),e.jsx(m,{variant:"secondary",size:"sm",onClick:j,isLoading:g,disabled:!r||d,className:"w-full",children:d?"Email sent!":"Resend verification email"}),e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>c("/login"),className:"w-full",children:"Back to login"})]})]})]})})}export{S as VerifyEmailPage};
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.