PageSourceSearch

https://alwaysintune.netlify.app/assets/Register-6a81CHX9.js

js alwaysintune.netlify.app collected 2026-10-03 10:26:50 UTC 3,632 bytes, 1 lines download raw bytes

1import{a,j as e}from"./query-vendor-BB0JUlq_.js";import{g as C}from"./unsplash-gQ5iVEsL.js";import{a as R}from"./index-CVuSjWCq.js";import{d as P}from"./react-vendor-BIjsaQ6L.js";import"./ui-vendor-CwH6wFZJ.js";function I(){const[i,w]=a.useState(""),[o,j]=a.useState(""),[l,y]=a.useState(""),[c,b]=a.useState(""),[p,r]=a.useState(""),[g,v]=a.useState(null),u=P(),{user:f,loading:h}=R();a.useEffect(()=>{h||f&&u("/dashboard",{replace:!0})},[f,h,u]),a.useEffect(()=>{(async()=>{const t=["music education","learning music","music school","piano lessons","guitar lessons"];let s=null;for(let d of t)if(s=await C(d),s)break;v(s)})()},[]);const N=async t=>{if(t.preventDefault(),r(""),!i||!o||!l||!c){r("Please fill in all fields");return}if(o!==c){r("Passwords do not match");return}if(o.length<8){r("Password must be at least 8 characters long");return}try{console.log("📝 Registration attempt for:",i);const s=await fetch("/api/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:i,password:o,name:l})});if(console.log("📡 Registration response status:",s.status),!s.ok){let m="Registration failed";try{const n=await s.json();console.log("📦 Error response:",n),m=n.error||n.details||"Registration failed"}catch(n){console.error("Failed to parse error response:",n);const x=await s.text();console.log("Response body (text):",x),m=`Registration failed (${s.status}): ${x||"No response body"}`}r(m);return}const d=await s.json();console.log("✅ Registration successful:",d),alert("Registration successful! Please complete your student intake application."),u("/student-intake")}catch(s){console.error("🔥 Registration exception:",s),r(s?.message||"Registration failed - check browser console for details")}};return e.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{backgroundImage:g?`linear-gradient(rgba(2,6,23,0.5), rgba(2,6,23,0.5)), url(${g})`:void 0,backgroundSize:"cover"},children:e.jsxs("div",{className:"bg-card/95 rounded-lg p-8 shadow-lg w-full max-w-md",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Create Account"}),e.jsx("p",{className:"text-sm text-foreground/70 mt-2",children:"Join In Tune Music Tuition to start your musical journey."}),e.jsxs("form",{onSubmit:N,className:"mt-4 space-y-4",children:[e.jsx("input",{name:"name",value:l,onChange:t=>y(t.target.value),className:"w-full h-10 rounded-md border px-3",placeholder:"Full Name",autoComplete:"name",required:!0}),e.jsx("input",{name:"email",type:"email",value:i,onChange:t=>w(t.target.value),className:"w-full h-10 rounded-md border px-3",placeholder:"Email Address",autoComplete:"email",required:!0}),e.jsx("input",{name:"password",value:o,onChange:t=>j(t.target.value),className:"w-full h-10 rounded-md border px-3",placeholder:"Password (min 8 characters)",type:"password",autoComplete:"new-password",required:!0}),e.jsx("input",{name:"confirmPassword",value:c,onChange:t=>b(t.target.value),className:"w-full h-10 rounded-md border px-3",placeholder:"Confirm Password",type:"password",autoComplete:"new-password",required:!0}),p&&e.jsx("div",{className:"text-sm text-red-600",children:p}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"submit",className:"h-10 px-4 rounded-md bg-primary text-primary-foreground",children:"Create Account"})})]}),e.jsx("div",{className:"mt-4 text-center",children:e.jsxs("p",{className:"text-sm text-foreground/70",children:["Already have an account?"," ",e.jsx("a",{href:"/login",className:"text-primary hover:underline",children:"Sign in"})]})})]})})}export{I 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.