PageSourceSearch

https://jobos.ai/assets/admin-login-new-CuEo9xAN.js

js jobos.ai collected 2026-10-05 12:07:21 UTC 6,153 bytes, 1 lines download raw bytes

1import{k as y,i as v,r as h,u as N,aj as S,a8 as A,j as e,z as l,aa as L,v as I,w as C,x as k,R,G as T,E as M,af as P,y as c,I as p,ak as E,al as F,am as z,J as D,an as B,ao as H,ap as O,aq as g}from"./index-DaUnvdE7.js";import{S as u}from"./shield-DMD2jMwY.js";import{L as q}from"./lock-ClvoKtIL.js";const G=H({email:g().email("Please enter a valid email address"),password:g().min(6,"Password must be at least 6 characters"),rememberMe:O().default(!1)});function $(){const{toast:r}=y(),[,i]=v(),[d,x]=h.useState(!1),[n,f]=h.useState(!1),{login:b}=N(),s=S({resolver:B(G),defaultValues:{email:"",password:"",rememberMe:!1}}),j=async a=>{x(!0);try{console.log("Admin login attempt for:",a.email);const t=await b(a.email,a.password);if(t.success){a.rememberMe&&(localStorage.setItem("adminRememberMe","true"),localStorage.setItem("adminLoginTime",Date.now().toString()));const m=await fetch("/api/admin/status");if(m.ok)if((await m.json()).isAdmin){const w=new URLSearchParams(window.location.search).get("redirect")||"/admin";i(w),r({title:"Admin Access Granted",description:`Welcome back, ${a.email}`})}else await fetch("/api/auth/logout",{method:"POST"}),r({title:"Access Denied",description:"Administrator privileges required",variant:"destructive"});else r({title:"Access Verification Failed",description:"Unable to verify admin privileges",variant:"destructive"})}else r({title:"Login Failed",description:t.error||"Invalid credentials",variant:"destructive"})}catch(t){console.error("Admin login error:",t),r({title:"Login Error",description:"An unexpected error occurred",variant:"destructive"})}finally{x(!1)}};return A.useEffect(()=>{const a=localStorage.getItem("adminRememberMe"),t=localStorage.getItem("adminLoginTime");a==="true"&&t&&((Date.now()-parseInt(t))/864e5<30?fetch("/api/admin/status").then(o=>o.json()).then(o=>{o.isAdmin&&i("/admin")}).catch(()=>{localStorage.removeItem("adminRememberMe"),localStorage.removeItem("adminLoginTime")}):(localStorage.removeItem("adminRememberMe"),localStorage.removeItem("adminLoginTime")))},[i]),e.jsxs("div",{style:{width:"100vw",height:"100vh",minHeight:"100vh",background:"linear-gradient(135deg, #1e293b 0%, #1e40af 50%, #1e293b 100%)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",position:"fixed",top:0,left:0,margin:0,overflow:"auto"},children:[e.jsx("div",{style:{position:"absolute",inset:"0",background:"rgba(0, 0, 0, 0.2)",opacity:"0.2"}}),e.jsxs(l,{variant:"ghost",onClick:()=>i("/"),style:{position:"absolute",top:"24px",left:"24px",color:"rgba(255, 255, 255, 0.7)",zIndex:10},className:"hover:text-white hover:bg-white/10",children:[e.jsx(L,{className:"h-4 w-4 mr-2"}),"Back to Home"]}),e.jsx("div",{style:{width:"100%",maxWidth:"400px",position:"relative",zIndex:20},children:e.jsxs(I,{className:"shadow-2xl border-0",style:{backgroundColor:"rgba(255, 255, 255, 0.95)"},children:[e.jsxs(C,{className:"text-center pb-2",children:[e.jsx("div",{style:{margin:"0 auto 16px",backgroundColor:"#dc2626",borderRadius:"50%",padding:"16px",width:"80px",height:"80px",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1)"},children:e.jsx(u,{className:"h-10 w-10 text-white"})}),e.jsx(k,{className:"text-2xl font-bold text-gray-900",children:"Admin Portal"}),e.jsx(R,{className:"text-gray-600",children:"Secure administrator access to platform management"}),e.jsxs(T,{variant:"outline",className:"mx-auto mt-2 border-red-200 text-red-700 bg-red-50",children:[e.jsx(q,{className:"h-3 w-3 mr-1"}),"Restricted Access"]})]}),e.jsxs(M,{className:"space-y-6",children:[e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3",children:e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx(P,{className:"h-4 w-4 text-amber-600 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm text-amber-800",children:[e.jsx("p",{className:"font-medium",children:"Administrator Login"}),e.jsx("p",{className:"text-xs mt-1",children:"Only authorized personnel should access this portal"})]})]})}),e.jsxs("form",{onSubmit:s.handleSubmit(j),className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"email",className:"text-sm font-medium text-gray-700",children:"Email Address"}),e.jsx(p,{id:"email",type:"email",placeholder:"[email protected]",...s.register("email"),className:"h-11"}),s.formState.errors.email&&e.jsx("p",{className:"text-xs text-red-600",children:s.formState.errors.email.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"password",className:"text-sm font-medium text-gray-700",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(p,{id:"password",type:n?"text":"password",placeholder:"Enter your admin password",...s.register("password"),className:"h-11 pr-10"}),e.jsx(l,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-11 px-3 py-2 hover:bg-transparent",onClick:()=>f(!n),children:n?e.jsx(E,{className:"h-4 w-4 text-gray-400"}):e.jsx(F,{className:"h-4 w-4 text-gray-400"})})]}),s.formState.errors.password&&e.jsx("p",{className:"text-xs text-red-600",children:s.formState.errors.password.message})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(z,{id:"rememberMe",...s.register("rememberMe")}),e.jsx(c,{htmlFor:"rememberMe",className:"text-sm text-gray-600 cursor-pointer",children:"Remember me for 30 days"})]}),e.jsx(l,{type:"submit",className:"w-full h-11 bg-red-600 hover:bg-red-700 text-white font-medium",disabled:d,children:d?e.jsxs("span",{className:"flex items-center justify-center",children:[e.jsx(D,{className:"h-4 w-4 animate-spin mr-2"}),"Authenticating..."]}):e.jsxs("span",{className:"flex items-center justify-center",children:[e.jsx(u,{className:"h-4 w-4 mr-2"}),"Access Admin Portal"]})})]}),e.jsx("div",{className:"text-center pt-4 border-t border-gray-200",children:e.jsxs("p",{className:"text-xs text-gray-500",children:["Need help? Contact"," ",e.jsx("a",{href:"mailto:[email protected]",className:"text-red-600 hover:text-red-700 font-medium",children:"[email protected]"})]})})]})]})})]})}export{$ 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.