/home/techb158/balavpn.abdallabala.com/.next/static/chunks/app/login
Edit: /home/techb158/balavpn.abdallabala.com/.next/static/chunks/app/login/page-3e025187c1cd3f25.js (4735B)
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4520],{63:(e,t,r)=>{"use strict";var s=r(7260);r.o(s,"useRouter")&&r.d(t,{useRouter:function(){return s.useRouter}}),r.o(s,"useSearchParams")&&r.d(t,{useSearchParams:function(){return s.useSearchParams}})},2475:(e,t,r)=>{Promise.resolve().then(r.bind(r,9107))},9107:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>o});var s=r(5155),i=r(2115),n=r(63);let a=[{role:"Platform Owner",email:"owner@cosmic.local",password:"cosmic123"},{role:"Admin",email:"admin@cosmic.local",password:"admin123"},{role:"Project Manager",email:"pm@cosmic.local",password:"pm123"},{role:"Risk Owner",email:"risk-owner@cosmic.local",password:"risk123"},{role:"Viewer",email:"viewer@cosmic.local",password:"view123"}];function o(){let e=(0,n.useRouter)(),[t,r]=(0,i.useState)(""),[o,l]=(0,i.useState)(""),[d,c]=(0,i.useState)(""),[u,m]=(0,i.useState)(!1),[p,h]=(0,i.useState)(!1),[g,x]=(0,i.useState)(!1);async function y(r){r.preventDefault(),c(""),m(!0);try{let r=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t,password:o})});if(!r.ok){let e=await r.json();throw Error(e.error||"Login failed")}e.push("/dashboard")}catch(e){c(e.message),m(!1)}}return(0,i.useEffect)(()=>{fetch("/api/auth/sso").then(e=>{501!==e.status&&h(!0)}).catch(()=>{})},[]),(0,s.jsx)("main",{className:"shell",style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh"},children:(0,s.jsxs)("div",{className:"panel",style:{maxWidth:420,width:"100%",padding:32},children:[(0,s.jsx)("div",{className:"brand",style:{fontSize:24,marginBottom:24,textAlign:"center"},children:"COSMIC AI-Risk SaaS"}),(0,s.jsx)("h2",{style:{marginBottom:8},children:"Sign in"}),(0,s.jsx)("p",{className:"muted",style:{marginBottom:24},children:"Enter your credentials to access the dashboard"}),d&&(0,s.jsx)("div",{style:{background:"var(--blocked-soft)",color:"var(--blocked)",padding:"8px 12px",borderRadius:8,marginBottom:16,fontSize:14},children:d}),(0,s.jsxs)("form",{onSubmit:y,children:[(0,s.jsxs)("div",{style:{marginBottom:16},children:[(0,s.jsx)("label",{style:{display:"block",marginBottom:4,fontSize:14,fontWeight:600},children:"Email"}),(0,s.jsx)("input",{type:"email",value:t,onChange:e=>r(e.target.value),required:!0,style:{width:"100%",padding:"10px 12px",borderRadius:8,border:"1px solid var(--line)",fontSize:16,boxSizing:"border-box"}})]}),(0,s.jsxs)("div",{style:{marginBottom:24},children:[(0,s.jsx)("label",{style:{display:"block",marginBottom:4,fontSize:14,fontWeight:600},children:"Password"}),(0,s.jsx)("input",{type:"password",value:o,onChange:e=>l(e.target.value),required:!0,style:{width:"100%",padding:"10px 12px",borderRadius:8,border:"1px solid var(--line)",fontSize:16,boxSizing:"border-box"}})]}),(0,s.jsx)("button",{type:"submit",className:"button primary",style:{width:"100%",padding:"12px 24px",fontSize:16},disabled:u,children:u?"Signing in...":"Sign in"})]}),p&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,margin:"16px 0"},children:[(0,s.jsx)("hr",{style:{flex:1,border:"none",borderTop:"1px solid var(--line)"}}),(0,s.jsx)("span",{className:"muted",style:{fontSize:12},children:"OR"}),(0,s.jsx)("hr",{style:{flex:1,border:"none",borderTop:"1px solid var(--line)"}})]}),(0,s.jsx)("a",{href:"/api/auth/sso",className:"button secondary",style:{width:"100%",padding:"12px 24px",fontSize:16,textAlign:"center"},children:"Sign in with SSO"})]}),(0,s.jsxs)("div",{style:{marginTop:16},children:[(0,s.jsx)("button",{onClick:()=>x(!g),style:{background:"none",border:"none",color:"var(--green)",cursor:"pointer",fontSize:14,width:"100%",textAlign:"center"},children:g?"Hide demo credentials":"Show demo credentials"}),g&&(0,s.jsxs)("div",{style:{marginTop:12,fontSize:13,background:"var(--bg-soft)",borderRadius:8,padding:12},children:[(0,s.jsx)("p",{className:"muted",style:{marginBottom:8},children:"Click a row to auto-fill:"}),a.map(e=>(0,s.jsxs)("div",{onClick:()=>{var t,s;return t=e.email,s=e.password,void(r(t),l(s))},style:{cursor:"pointer",padding:"6px 8px",borderRadius:6,display:"flex",justifyContent:"space-between",alignItems:"center"},onMouseEnter:e=>e.currentTarget.style.background="var(--line)",onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[(0,s.jsx)("span",{style:{fontWeight:600},children:e.role}),(0,s.jsx)("span",{className:"muted",style:{fontSize:12},children:e.email})]},e.email))]})]}),(0,s.jsx)("p",{style:{marginTop:16,textAlign:"center",fontSize:14},children:(0,s.jsx)("a",{href:"/signup",style:{color:"var(--green)"},children:"Create an account"})})]})})}}},e=>{e.O(0,[8441,1255,7358],()=>e(e.s=2475)),_N_E=e.O()}]);