(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4520],{17:(e,r,s)=>{"use strict";s.r(r),s.d(r,{default:()=>u});var t=s(5155),a=s(2115),o=s(9176),l=s(63),d=s(2619),n=s.n(d),i=s(1878);function u(){let[e,r]=(0,a.useState)(""),[s,d]=(0,a.useState)(""),[u,c]=(0,a.useState)(""),[m,g]=(0,a.useState)(!1),[h,x]=(0,a.useState)(!1),{login:b}=(0,o.A)(),p=(0,l.useRouter)(),f=async r=>{r.preventDefault(),g(!0),c("");try{let r=await b(e,s);r.success?setTimeout(()=>{r.needsPasswordChange?p.push("/change-password"):p.push("/dashboard")},0):c(r.error||"Invalid email or password")}catch(e){console.error("Login error:",e),c("An error occurred during login")}finally{g(!1)}};return(0,t.jsx)("div",{className:"min-h-screen flex flex-col items-center justify-center bg-linear-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800 p-4",children:(0,t.jsxs)("div",{className:"w-full max-w-md bg-white dark:bg-gray-800 rounded-xl shadow-xl overflow-hidden",children:[(0,t.jsxs)("div",{className:"p-6 text-center bg-gray-100 dark:bg-gray-900",children:[(0,t.jsx)(n(),{href:"/",className:"inline-block mb-2",children:(0,t.jsx)(i.A,{src:"/images/logo.png",width:80,height:80})}),(0,t.jsx)("p",{className:"text-blue-900 dark:text-blue-100 mt-2",children:"Sign in to your account"})]}),(0,t.jsxs)("form",{className:"p-8 space-y-6",onSubmit:f,children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Email address"}),(0,t.jsx)("input",{id:"email",name:"email",type:"email",autoComplete:"email",required:!0,value:e,onChange:e=>r(e.target.value),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:"Enter your email"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Password"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("input",{id:"password",name:"password",type:h?"text":"password",autoComplete:"current-password",required:!0,value:s,onChange:e=>d(e.target.value),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white pr-10",placeholder:"Enter your password"}),(0,t.jsx)("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",onClick:()=>{x(!h)},children:h?(0,t.jsxs)("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}):(0,t.jsx)("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})})})]})]}),u&&(0,t.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 p-3 rounded-lg text-sm",children:u}),(0,t.jsx)("div",{children:(0,t.jsx)("button",{type:"submit",disabled:m,className:"w-full flex justify-center mt-10 py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-white bg-blue-800 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 cursor-pointer",children:m?"Signing in...":"Sign in"})})]})]})})}},1537:(e,r,s)=>{Promise.resolve().then(s.bind(s,17))},1878:(e,r,s)=>{"use strict";s.d(r,{A:()=>o});var t=s(5155),a=s(5239);let o=e=>{let{src:r,width:s=80,height:o=80,alt:l="Logo",className:d="inline-block",...n}=e;return(0,t.jsx)(a.default,{src:r,alt:l,width:s,height:o,priority:!0,className:d,...n})}}},e=>{e.O(0,[176,5239,9176,8441,1255,7358],()=>e(e.s=1537)),_N_E=e.O()}]);