1import{a as g,r as d,j as e,L as x}from"./index-BoTbwFO0.js";function f(){const p=g(),[a,u]=d.useState({email:"",password:""}),[r,t]=d.useState(!1),[c,o]=d.useState({text:"",type:""}),m=n=>{u({...a,[n.target.name]:n.target.value})},h=async n=>{n.preventDefault(),t(!0),o({text:"",type:""});try{const s=await fetch("/api/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a.email,password:a.password})});if(!s.ok){let l="Login failed. Please check your credentials.";try{l=(await s.json()).message||l}catch{l=`Server error: ${s.status} ${s.statusText}`}o({text:l,type:"error"}),t(!1);return}const i=await s.json();i.success&&i.token?(sessionStorage.setItem("auth_token",i.token),p("/sales/workbench")):(o({text:i.message||"Login failed. Please check your credentials.",type:"error"}),t(!1))}catch(s){console.error("Login error:",s),o({text:`Connection error: ${s.message}. Please make sure the backend service is running and configured in environment variables.`,type:"error"}),t(!1)}};return e.jsx("div",{className:"login-page",children:e.jsx("div",{className:"login-container",children:e.jsxs("div",{className:"login-card",children:[e.jsxs("div",{className:"login-header",children:[e.jsx("h1",{children:"Sales Login"}),e.jsx("p",{children:"Use your account name. The shared inbox is [email protected]."})]}),e.jsxs("form",{onSubmit:h,className:"login-form",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"email",children:"Account"}),e.jsx("input",{type:"text",id:"email",name:"email",value:a.email,onChange:m,required:!0,placeholder:"gunther, etienne, or aiden",autoComplete:"username"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"password",children:"Password"}),e.jsx("input",{type:"password",id:"password",name:"password",value:a.password,onChange:m,required:!0,placeholder:"Enter your password",autoComplete:"current-password"})]}),e.jsxs("div",{className:"form-options",children:[e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox"}),e.jsx("span",{children:"Remember me"})]}),e.jsx(x,{to:"/forgot-password",className:"forgot-link",children:"Forgot password?"})]}),c.text&&e.jsx("div",{className:`message ${c.type}`,children:c.text}),e.jsx("button",{type:"submit",className:"btn-primary-obsidian",disabled:r,style:{width:"100%",opacity:r?.5:1,cursor:r?"not-allowed":"pointer"},children:e.jsx("span",{children:r?"Logging in...":"Login"})})]}),e.jsx("div",{className:"login-footer",children:e.jsx("p",{children:"Access is managed internally."})})]})})})}export{f 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.