PageSourceSearch

https://ai-discoverability-audit.lovable.app/assets/auth-DuQvKvtc.js

js ai-discoverability-audit.lovable.app collected 2026-10-03 03:18:40 UTC 3,487 bytes, 1 lines download raw bytes

1import{r,j as e,u as j,a as N,s as g,t as w}from"./index-kUL3T2lt.js";import{S,a as P}from"./site-header-CXKyOnUC.js";import{c as h,a as C,b as R,B as A}from"./button-D0yLHGUU.js";const f=r.forwardRef(({className:a,type:s,...t},i)=>e.jsx("input",{type:s,className:h("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:i,...t}));f.displayName="Input";var E=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=E.reduce((a,s)=>{const t=C(`Primitive.${s}`),i=r.forwardRef((o,u)=>{const{asChild:l,...m}=o,c=l?t:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(c,{...m,ref:u})});return i.displayName=`Primitive.${s}`,{...a,[s]:i}},{}),L="Label",b=r.forwardRef((a,s)=>e.jsx(D.label,{...a,ref:s,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(a.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));b.displayName=L;var v=b;const M=R("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),p=r.forwardRef(({className:a,...s},t)=>e.jsx(v,{ref:t,className:h(M(),a),...s}));p.displayName=v.displayName;function q(){const a=j(),s=N(),[t,i]=r.useState("signin"),[o,u]=r.useState(""),[l,m]=r.useState(""),[c,x]=r.useState(!1);async function y(d){d.preventDefault(),x(!0);try{if(t==="signin"){const{error:n}=await g.auth.signInWithPassword({email:o,password:l});if(n)throw n}else{const{error:n}=await g.auth.signUp({email:o,password:l,options:{emailRedirectTo:`${window.location.origin}/admin`}});if(n)throw n;w.success("Account created. An existing admin must grant you access.")}await s.invalidate(),a({to:"/admin"})}catch(n){w.error(n?.message??"Authentication failed")}finally{x(!1)}}return e.jsxs("div",{className:"min-h-screen flex flex-col",children:[e.jsx(S,{}),e.jsx("main",{className:"flex-1 container-narrow py-16 flex items-center justify-center",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-8 shadow-sm",children:[e.jsx("h1",{className:"font-serif text-3xl text-foreground",children:"Admin sign in"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Restricted area. Only approved administrators may view submissions."}),e.jsxs("form",{onSubmit:y,className:"mt-6 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"email",children:"Email"}),e.jsx(f,{id:"email",type:"email",autoComplete:"email",required:!0,value:o,onChange:d=>u(d.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"password",children:"Password"}),e.jsx(f,{id:"password",type:"password",autoComplete:t==="signin"?"current-password":"new-password",required:!0,minLength:8,value:l,onChange:d=>m(d.target.value)})]}),e.jsx(A,{type:"submit",disabled:c,className:"w-full",children:c?"Please wait…":t==="signin"?"Sign in":"Create account"})]}),e.jsx("button",{type:"button",onClick:()=>i(t==="signin"?"signup":"signin"),className:"mt-4 text-xs text-muted-foreground hover:text-foreground",children:t==="signin"?"Need an account? Create one":"Already have an account? Sign in"})]})}),e.jsx(P,{})]})}export{q 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.