PageSourceSearch

https://gradethread.com/assets/auth-confirm-mpaSZg_y.js

js gradethread.com collected 2026-10-10 01:46:12 UTC 5,837 bytes, 1 lines download raw bytes

1import{n as $,q as H,k as s,j as e,L as M}from"./vendor-react-CowE5YCj.js";import{k as G,v as K,r as O}from"./auth-CcWyxVus.js";import{PENDING_INVITE_KEY as Y}from"./accept-invite-CY6b4Kl5.js";import{t as z,c as Q}from"./return-to-XehW0nDU.js";import{c5 as U,bR as J,ce as m,t as k,x as S,y as T,v as _,u as R,g as I,w as X,cd as y}from"./index-BwzqfZRD.js";import{I as P}from"./input-CLuxJVgs.js";import{L}from"./label-CGppZHlV.js";import{F as Z}from"./form-feedback-pkrNDt8r.js";import{S as ee}from"./seo-Bc6Qy8zj.js";import"./toast-error-BDOwNR3J.js";import"./friendly-error-BmcA0avy.js";import"./use-auth-FaZySznk.js";import"./support-reply-seen-BDrHZ8u4.js";import"./workspace-profiles-D9dKaE-w.js";import"./inventory-selection-gR-I3mZn.js";import"./idle-logout-DmhfCCf2.js";import"./autolister-session-idb-LDIUcsJC.js";import"./badge-DOjUnpLH.js";import"./workspace-permissions-Cc1rEeUa.js";import"./vendor-query-VEVGS95H.js";import"./vendor-supabase-Baxrk5fR.js";import"./index-clxdtWr2.js";import"./circle-alert-O2pEuqlX.js";let q=!1;const te=new Set(["signup","email"]);function B(i){if(i!==null&&!te.has(i))return;const n="AW-18284582053",a="jQR7CIn2vPEcEKWp4o5E";try{q||(window.gtag?.("config",n),q=!0),window.gtag?.("event","conversion",{send_to:`${n}/${a}`})}catch{}}function V({children:i}){return e.jsxs("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:[e.jsx(ee,{title:"Confirming your email",noindex:!0}),e.jsxs("div",{className:"w-full max-w-md",children:[e.jsx("div",{className:"mb-8 flex justify-center",children:e.jsx("img",{src:"/logo_primary.png",width:1806,height:376,alt:"GradeThread",className:"h-10"})}),i]})]})}function be(){const i=$(),[n]=H(),a=n.get("token_hash"),d=n.get("type"),j=n.get("redirect_to"),v=n.get("email")??"",[o,A]=s.useState(v),[w,D]=s.useState(""),[f,h]=s.useState(a?"verifying":"form"),[C,c]=s.useState(null),[p,E]=s.useState(!1),[l,g]=s.useState(0);s.useEffect(()=>{const{url:t,changed:r}=U(window.location.href);r&&window.history.replaceState(window.history.state,"",t)},[]);const x=s.useCallback(()=>{const t=J(Y,"session");if(t){i(`/accept-invite?token=${t}`,{replace:!0});return}const r=z(),u=Q(j);i(r??u??"/dashboard",{replace:!0})},[i,j]),N=s.useRef(!1);s.useEffect(()=>{!a||N.current||(N.current=!0,(async()=>{try{await G(a,d),m("signup.email_verified",{via:"link"}),B(d),x()}catch{m("signup.verify_failed",{reason:"link_expired"}),h("form"),c("That confirmation link is invalid or has expired. Enter the code from your email, or request a new one.")}})())},[a,d,x]),s.useEffect(()=>{if(l<=0)return;const t=setTimeout(()=>g(r=>r-1),1e3);return()=>clearTimeout(t)},[l]);async function F(t){t.preventDefault(),c(null);const r=w.replace(/\s+/g,"");if(!o){c("Enter the email address you signed up with."),document.getElementById("confirm-email")?.focus();return}if(r.length<6){c("Enter the 6-digit code from your email."),document.getElementById("confirm-code")?.focus();return}h("submitting");try{await K(o,r,d),m("signup.email_verified",{via:"code"}),B(d),x()}catch(u){const b=u instanceof Error?u.message.toLowerCase():"";m("signup.verify_failed",{reason:b.includes("expired")?"code_expired":"code_rejected"}),c(b.includes("expired")?"That code has expired. Request a new one below.":"That code is incorrect or expired. Double-check it, or request a new one."),h("form")}}async function W(){if(!(p||l>0||!o)){E(!0);try{await O(o),m("signup.confirm_resend",{at:"confirm"}),y.success("If that account needs confirming, we've sent a new code."),g(45)}catch(t){const r=t instanceof Error?t.message.toLowerCase():"";r.includes("rate")||r.includes("429")||r.includes("too many")?(y.error("Too many requests — please wait a moment and try again."),g(45)):y.error("We couldn't resend the email. Please try again shortly.")}finally{E(!1)}}}return f==="verifying"?e.jsx(V,{children:e.jsxs(k,{children:[e.jsxs(S,{className:"text-center",children:[e.jsx(T,{children:"Confirming your email…"}),e.jsx(_,{children:"This only takes a moment."})]}),e.jsx(R,{className:"flex justify-center py-6",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})]})}):e.jsx(V,{children:e.jsxs(k,{children:[e.jsxs(S,{className:"text-center",children:[e.jsx(T,{className:"text-2xl",children:"Confirm your email"}),e.jsx(_,{children:"Enter the 6-digit code we emailed you to verify your account."})]}),e.jsxs(R,{children:[e.jsxs("form",{onSubmit:F,className:"space-y-4",noValidate:!0,children:[!v&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"confirm-email",children:"Email"}),e.jsx(P,{id:"confirm-email",type:"email",placeholder:"[email protected]",value:o,onChange:t=>A(t.target.value),autoComplete:"email",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"confirm-code",children:"Verification code"}),e.jsx(P,{id:"confirm-code",inputMode:"numeric",autoComplete:"one-time-code",placeholder:"123456",maxLength:6,value:w,onChange:t=>{D(t.target.value.replace(/[^0-9]/g,"")),C&&c(null)},className:"text-center text-lg tracking-[0.4em]",required:!0}),e.jsx(Z,{id:"confirm-code-error",children:C??void 0})]}
1),e.jsx(I,{type:"submit",className:"w-full",disabled:f==="submitting",children:f==="submitting"?"Verifying…":"Verify email"})]}),e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Didn't get a code? Check your spam folder, or resend it."}),e.jsx(I,{type:"button",variant:"outline",className:"mt-3",disabled:p||l>0||!o,onClick:W,children:p?"Sending…":l>0?`Resend in ${l}s`:"Resend code"})]})]}),e.jsx(X,{className:"justify-center",children:e.jsx(M,{to:"/login",className:"text-sm text-brand-red-text hover:underline",children:"Back to sign in"})})]})})}export{be as AuthConfirmPage};

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.