PageSourceSearch

https://geltoynation.com/assets/auth-D7u38PzS.js

js geltoynation.com collected 2026-10-04 02:39:32 UTC 2,780 bytes, 1 lines download raw bytes

1import{m as w,r as n,s as d,j as e,L as N}from"./index-BCW6nnV8.js";function y(){const r=w(),[a,u]=n.useState("signin"),[o,p]=n.useState(""),[i,b]=n.useState(""),[m,g]=n.useState(!1),[x,l]=n.useState(null),[h,c]=n.useState(null);n.useEffect(()=>{d.auth.getUser().then(({data:t})=>{t.user&&r({to:"/admin/chats",replace:!0})})},[r]);const f=async t=>{t.preventDefault(),c(null),l(null),g(!0);try{if(a==="signin"){const{error:s}=await d.auth.signInWithPassword({email:o.trim(),password:i});if(s)throw s;r({to:"/admin/chats",replace:!0})}else{const{error:s}=await d.auth.signUp({email:o.trim(),password:i,options:{emailRedirectTo:`${window.location.origin}/admin/chats`}});if(s)throw s;l("Account created. Check your email to confirm, then sign in."),u("signin")}}catch(s){c(s.message||"Authentication failed")}finally{g(!1)}};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4",children:e.jsxs("div",{className:"w-full max-w-sm",children:[e.jsxs(N,{to:"/",className:"block text-center mb-6 font-display text-xl font-bold tracking-wider",children:["GELTOY",e.jsx("span",{className:"text-brand",children:"NATION"})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-surface/40 p-6 shadow-xl",children:[e.jsx("h1",{className:"font-display text-xl font-bold uppercase tracking-wider mb-1",children:a==="signin"?"Admin sign in":"Create admin account"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-5",children:"Staff access only."}),e.jsxs("form",{onSubmit:f,className:"space-y-3",children:[e.jsx("input",{type:"email",required:!0,autoComplete:"email",placeholder:"[email protected]",value:o,onChange:t=>p(t.target.value),className:"w-full h-10 rounded-lg bg-background border border-border px-3 text-sm focus:border-brand focus:outline-none"}),e.jsx("input",{type:"password",required:!0,minLength:6,autoComplete:a==="signin"?"current-password":"new-password",placeholder:"Password",value:i,onChange:t=>b(t.target.value),className:"w-full h-10 rounded-lg bg-background border border-border px-3 text-sm focus:border-brand focus:outline-none"}),h&&e.jsx("p",{className:"text-xs text-red-500",children:h}),x&&e.jsx("p",{className:"text-xs text-green-500",children:x}),e.jsx("button",{type:"submit",disabled:m,className:"w-full h-10 rounded-lg bg-brand text-brand-foreground text-sm font-semibold uppercase tracking-wider hover:brightness-110 disabled:opacity-50",children:m?"…":a==="signin"?"Sign in":"Create account"})]}),e.jsx("button",{type:"button",onClick:()=>{u(t=>t==="signin"?"signup":"signin"),c(null),l(null)},className:"mt-4 w-full text-xs text-muted-foreground hover:text-foreground",children:a==="signin"?"Need an account? Create one":"Already have an account? Sign in"})]})]})})}export{y as component};

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.