PageSourceSearch

https://tutorbuddi.ai/assets/ParentSignup-D4cSucWX.js

js tutorbuddi.ai collected 2026-10-05 13:59:43 UTC 7,659 bytes, 1 lines download raw bytes

1import{j as e}from"./ui-Dqaq1iaa.js";import{r as s,u as a}from"./vendor-D_xiAuUj.js";import{E as r,y as t,s as n,z as o}from"./index-BnJJh0He.js";import{P as l,v as i}from"./PasswordChecklist-BajyoPwe.js";import{e as d}from"./edgeError-TX0_vJhG.js";import{A as c}from"./arrow-left-D11zA1iW.js";import{E as m}from"./eye-off-D5vNtYnW.js";import"./supabase-XAR8dl0U.js";import"./loader-circle-Cc0eb4Pc.js";function u(){const[u,x]=s.useState({username:"",parentName:"",email:"",password:"",confirmPassword:""}),[p,h]=s.useState(!1),[y,f]=s.useState(""),[v,b]=s.useState(!1),[g,w]=s.useState(!1),[j,N]=s.useState(!1),k=a();return e.jsx("div",{className:"min-h-screen bg-bone flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-card rounded-2xl shadow-xl ring-1 ring-navy/10 p-8 w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsxs("button",{onClick:()=>k("/account-type"),className:"inline-flex items-center text-navy/70 hover:text-navy mb-4",children:[e.jsx(c,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsx("img",{src:"/brand-mark.png",alt:"TutorBuddi",className:"w-16 h-16 rounded-2xl mx-auto mb-4"}),e.jsx("h1",{className:"font-display text-2xl text-navy tracking-[0.03em]",children:"Create Parent Account"}),e.jsx("p",{className:"text-navy/70",children:"Set up your family learning account"})]}),e.jsxs("form",{onSubmit:async e=>{if(e.preventDefault(),h(!0),f(""),!u.username||u.username.length<3||u.username.length>20)return f("Username must be between 3 and 20 characters"),void h(!1);if(!/^[a-zA-Z0-9_]+$/.test(u.username))return f("Username can only contain letters, numbers, and underscores"),void h(!1);const s=i(u.password,u.confirmPassword);if(!s.isValid)return f(s.failedRules.join(", ")),void h(!1);if(!j)return f("Please agree to the Terms of Use and Privacy Policy to continue."),void h(!1);try{const{data:e,error:s}=await n.functions.invoke("parent-signup",{body:{email:u.email,password:u.password,parentName:u.parentName,username:u.username}});if(s)throw new Error(await d(s,"Registration failed. Please try again."));if(null==e?void 0:e.error)throw new Error(e.error);localStorage.setItem(o,String(g)),k(`/verify-email?type=parent&email=${encodeURIComponent(u.email)}`)}catch(a){let e=a.message||"Registration failed. Please try again.";e.includes("User already registered")||e.includes("already exists")?e="An account with this email already exists. Please login instead or use a different email.":e.includes("username is already taken")?e="This username is already taken. Please choose a different username.":(e.toLowerCase().includes("weak")||e.toLowerCase().includes("easy to guess"))&&(e='This password is too common or predictable. Try using a unique phrase, mix of unrelated words, or random characters. Avoid common patterns like "Password123" or dictionary words.'),f(e)}finally{h(!1)}},className:"space-y-6",children:[y&&e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:[e.jsx("p",{className:"text-red-800 text-sm",children:y}),(y.includes("already exists")||y.includes("already registered"))&&e.jsx("button",{onClick:()=>k("/login"),className:"text-red-600 hover:text-red-700 text-sm font-medium underline mt-2",children:"Go to login page"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-navy/80 mb-2",children:"Username"}),e.jsx("input",{type:"text",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,value:u.username,onChange:e=>x({...u,username:e.target.value.toLowerCase()}),className:"w-full px-4 py-3 border border-navy/15 rounded-xl focus:outline-none focus:ring-2 focus:ring-navy",placeholder:"Choose a username",pattern:"[a-zA-Z0-9_]{3,20}",minLength:3,maxLength:20,required:!0}),e.jsx("p",{className:"text-xs text-navy/55 mt-1",children:"3-20 characters, letters, numbers, and underscores only"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-navy/80 mb-2",children:"Parent/Guardian Name"}),e.jsx("input",{type:"text",value:u.parentName,onChange:e=>x({...u,parentName:e.target.value}),className:"w-full px-4 py-3 border border-navy/15 rounded-xl focus:outline-none focus:ring-2 focus:ring-navy",placeholder:"Enter your full name",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-navy/80 mb-2",children:"Email Address"}),e.jsx("input",{type:"email",value:u.email,onChange:e=>x({...u,email:e.target.value}),className:"w-full px-4 py-3 border border-navy/15 rounded-xl focus:outline-none focus:ring-2 focus:ring-navy",placeholder:"Enter your email",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-navy/80 mb-2",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:v?"text":"password",value:u.password,onChange:e=>x({...u,password:e.target.value}),className:"w-full px-4 py-3 pr-12 border border-navy/15 rounded-xl focus:outline-none focus:ring-2 focus:ring-navy",placeholder:"Create a password",required:!0}),e.jsx("button",{type:"button",onClick:()=>b(e=>!e),"aria-label":v?"Hide password":"Show password",className:"absolute inset-y-0 right-0 flex items-center pr-4 text-navy/50 hover:text-navy",children:v?e.jsx(m,{className:"h-5 w-5"}):e.jsx(r,{className:"h-5 w-5"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-navy/80 mb-2",children:"Confirm Password"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:v?"text":"password",value:u.confirmPassword,onChange:e=>x({...u,confirmPassword:e.target.value}),className:"w-full px-4 py-3 pr-12 border border-navy/15 rounded-xl focus:outline-none focus:ring-2 focus:ring-navy",placeholder:"Confirm your password",required:!0}),e.jsx("button",{type:"button",onClick:()=>b(e=>!e),"aria-label":v?"Hide password":"Show password",className:"absolute inset-y-0 right-0 flex items-center pr-4 text-navy/50 hover:text-navy",children:v?e.jsx(m,{className:"h-5 w-5"}):e.jsx(r,{className:"h-5 w-5"})})]})]}),(u.password||u.confirmPassword)&&e.jsxs("div",{className:"bg-navy/[0.03] border border-navy/10 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm font-medium text-navy/80 mb-2",children:"Password Requirements:"}),e.jsx(l,{password:u.password,confirmPassword:u.confirmPassword,showMatchCheck:!0})]}),e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer text-left",children:[e.jsx("input",{type:"checkbox",checked:j,onChange:e=>N(e.target.checked),className:"mt-0.5 h-4 w-4 shrink-0 rounded border-navy/30 text-navy focus:ring-navy"}),e.jsxs("span",{className:"text-sm text-navy/70",children:["I agree to the"," ",e.jsx("button",{type:"button",onClick:()=>t("/terms"),className:"text-navy underline",children:"Terms of Use"})," ","and"," ",e.jsx("button",{type:"button",onClick:()=>t("/privacy"),className:"text-navy underline",children:"Privacy Policy"}),"."]})]}),e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer text-left",children:[e.jsx("input",{type:"checkbox",checked:g,onChange:e=>w(e.target.checked),className:"mt-0.5 h-4 w-4 shrink-0 rounded border-navy/30 text-navy focus:ring-navy"}),e.jsx("span",{className:"text-sm text-navy/70",children:"I'd like to receive emails from TutorBuddi about tips, updates, and resources"})]}),e.jsx("button",{type:"submit",disabled:p||!j||!i(u.password,u.confirmPassword).isValid,className:"w-full bg-navy text-white py-3 px-6 rounded-xl font-medium text-lg hover:bg-[hsl(var(--primary-hover))] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:p?"Creating Account...":"Create Parent Account"})]})]})})}export{u 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.