1import{v as y,r as t,s as r,j as e,G as C,B as S,W as l}from"./index-CJsdPNqw.js";import{I as u}from"./input-6HDAZ3VH.js";import{L as h}from"./label-4ReTXD7P.js";import{C as E,a as L,b as F,c as k,d as z}from"./card-Dw44dnhl.js";import{L as x}from"./loader-circle-jLJENuxj.js";import{L as A}from"./lock-BQdGLDW9.js";function D(){const o=y(),[n,i]=t.useState(!1),[f,g]=t.useState(!0),[c,b]=t.useState(""),[d,p]=t.useState("");t.useEffect(()=>{j()},[]);const j=async()=>{const{data:{session:s}}=await r.auth.getSession();if(s){const{data:a}=await r.from("jfc_authorized_users").select("email").eq("email",s.user.email).maybeSingle();if(a){o("/jfc-submissions");return}}g(!1)},w=async s=>{s.preventDefault(),i(!0);try{const{data:a,error:m}=await r.auth.signInWithPassword({email:c.trim(),password:d});if(m){l.error(m.message),i(!1);return}const{data:N,error:v}=await r.from("jfc_authorized_users").select("email").eq("email",a.user.email).maybeSingle();if(v||!N){await r.auth.signOut(),l.error("You are not authorized to access JFC submissions."),i(!1);return}l.success("Login successful!"),o("/jfc-submissions")}catch(a){l.error("An error occurred during login."),console.error(a)}finally{i(!1)}};return f?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center",children:e.jsx(x,{className:"h-8 w-8 animate-spin text-white"})}):e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-4",children:e.jsxs(E,{className:"w-full max-w-md border-slate-700 bg-slate-800/50 backdrop-blur-sm",children:[e.jsxs(L,{className:"text-center space-y-4",children:[e.jsx("div",{className:"mx-auto w-16 h-16 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-2xl flex items-center justify-center shadow-lg",children:e.jsx(C,{className:"h-8 w-8 text-white"})}),e.jsxs("div",{children:[e.jsx(F,{className:"text-2xl font-bold text-white",children:"JFC Submissions"}),e.jsx(k,{className:"text-slate-400",children:"Sign in to access the submissions dashboard"})]})]}),e.jsx(z,{children:e.jsxs("form",{onSubmit:w,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"email",className:"text-slate-300",children:"Email"}),e.jsx(u,{id:"email",type:"email",value:c,onChange:s=>b(s.target.value),placeholder:"Enter your email",required:!0,className:"bg-slate-700/50 border-slate-600 text-white placeholder:text-slate-500"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"password",className:"text-slate-300",children:"Password"}),e.jsx(u,{id:"password",type:"password",value:d,onChange:s=>p(s.target.value),placeholder:"Enter your password",required:!0,className:"bg-slate-700/50 border-slate-600 text-white placeholder:text-slate-500"})]}),e.jsx(S,{type:"submit",className:"w-full bg-gradient-to-r from-blue-500 to-indigo-600 hover:from-blue-600 hover:to-indigo-700 text-white font-semibold",disabled:n,children:n?e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in..."]}):e.jsxs(e.Fragment,{children:[e.jsx(A,{className:"mr-2 h-4 w-4"}),"Sign In"]})})]})})]})})}export{D 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.