PageSourceSearch

https://www.theuniguide.com/assets/sign-up-DGIFLXQf.js

js theuniguide.com collected 2026-10-04 08:37:50 UTC 3,604 bytes, 1 lines download raw bytes

1import{D as I,a as L,r as o,j as e,aq as S,L as g,ar as w,at as U,au as R,av as W,ax as $,ay as q,az as B}from"./index-DI8w2tsm.js";import{m as D,a as F}from"./inviteHandoff--ccnk9hx.js";const T="/".replace(/\/$/,"");function V(){const c=new URLSearchParams(window.location.search),l=c.get("email")??"",s=c.get("redirect"),t=s&&s.startsWith("/")&&!s.startsWith("//")?s:"/",a=new URL(t,window.location.origin),r=a.searchParams.get("scope"),h=r==="institution"||r==="tenant"?r:null,n=a.searchParams.get("token")??"",d=Number.parseInt(a.searchParams.get("inviteId")??"",10),i=a.searchParams.get("email")??"",v=a.pathname.endsWith("/accept-invite")&&h!==null&&n&&Number.isInteger(d)&&d>0&&i.toLowerCase()===l.toLowerCase()?{scope:h,token:n,inviteId:d}:null;return{invitedEmail:l,redirect:t,inviteProof:v}}function O(){const[,c]=I(),l=L(),{invitedEmail:s,redirect:t,inviteProof:a}=V(),[r,h]=o.useState(""),[n,d]=o.useState(s),[i,v]=o.useState(""),[j,u]=o.useState(null),[p,m]=o.useState(!1),[P,k]=o.useState(!1),C=t.startsWith("/accept-invite?")?D(t):t,y=`${window.location.origin}${T}${C}`,x=a?`/sign-in?redirect=${encodeURIComponent(t)}`:"/sign-in",N=async E=>{if(E.preventDefault(),u(null),i.length<8){u("Password must be at least 8 characters.");return}if(m(!0),a){try{if(!(await $({email:n,password:i,name:r.trim()||n,...a})).token){m(!1),u("An account already exists for this email. Sign in to accept the invitation.");return}l.clear(),await q().catch(()=>{}),m(!1),c(F(t))}catch(f){m(!1),u(f instanceof Error&&f.message?f.message:"This invitation could not be used. Ask the sender for a new invite link.")}return}const{data:A,error:b}=await B.email({email:n,password:i,name:r.trim()||n,callbackURL:y});if(m(!1),b){u(b.message||"Unable to create your account. Please try again.");return}if(!!A?.token){l.clear(),c(t);return}k(!0)};return P?e.jsx(S,{title:"Check your email",subtitle:`We've sent a verification link to ${n}. Click it to activate your account and continue.`,footer:e.jsx(g,{href:x,className:"font-medium text-primary hover:underline",children:"Back to sign in"}),children:e.jsxs("div",{className:"space-y-3 rounded-md border border-border bg-accent/40 px-4 py-3 text-sm text-muted-foreground","data-testid":"verification-sent",children:[e.jsx("p",{children:"Didn't get the email? Check your spam folder."}),e.jsxs("p",{children:["Already have an account with this email? No new account is created and no verification email is sent — instead we email you a reminder."," ",e.jsx(g,{href:x,className:"font-medium text-primary hover:underline",children:"Sign in"})," ","or"," ",e.jsx(g,{href:"/forgot-password",className:"font-medium text-primary hover:underline",children:"reset your password"})," ","to get back in."]})]})}):e.jsxs(S,{title:"Create your account",subtitle:"Sign up to get started.",footer:e.jsxs(e.Fragment,{children:["Already have an account?"," ",e.jsx(g,{href:x,className:"font-medium text-primary hover:underline",children:"Sign in"})]}),children:[e.jsxs("form",{onSubmit:N,className:"space-y-4","data-testid":"sign-up-form",children:[e.jsx(w,{id:"name",label:"Name",value:r,onChange:h,autoComplete:"name",placeholder:"Optional",disabled:p}),e.jsx(w,{id:"email",label:"Email",type:"email",value:n,onChange:d,autoComplete:"email",required:!0,disabled:p||!!s}),e.jsx(w,{id:"password",label:"Password",type:"password",value:i,onChange:v,autoComplete:"new-password",required:!0,placeholder:"At least 8 characters",disabled:p}),e.jsx(U,{message:j}),e.jsx(R,{pending:p,testId:"sign-up-submit",children:"Create account"})]}),e.jsx(W,{callbackURL:y})]})}export{O 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.