1import{c as S,r as a,u as q,a as A,j as e,s as M}from"./index-wgYSPoc2.js";import{M as N}from"./mail-Q70UpqMi.js";import{K as R}from"./key-round-Cn-FfxzE.js";import{L as K}from"./lock-BocYAumv.js";/** 2 * @license lucide-react v0.344.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const B=S("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** 7 * @license lucide-react v0.344.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const D=S("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);function V(r){return r.includes("Invalid login credentials")?"login.err.invalidCredentials":r.includes("User already registered")?"login.err.alreadyRegistered":r.includes("Email not confirmed")?"login.err.emailNotConfirmed":null}function J(){const[r,f]=a.useState(""),[i,p]=a.useState(""),[o,h]=a.use
11State(!1),[g,k]=a.useState(""),[L,d]=a.useState(!1),[y,l]=a.useState(""),[c,n]=a.useState(!1),[j,m]=a.useState(!1),[U,b]=a.useState(!1),{signIn:F,signUp:C}=q(),{t,lang:x,setLang:E}=A(),I=async s=>{s.preventDefault(),l(""),n(!0);try{await M.auth.resetPasswordForEmail(r,{redirectTo:`${window.location.origin}/reset-password`})}catch(u){console.error("Reset email error:",u)}finally{b(!0),n(!1)}},P=async s=>{s.preventDefault(),l(""),d(!1),n(!0);try{if(o){if(!g.trim()){l(t("login.err.nameRequired")),n(!1);return}if(i.length<6){l(t("login.err.passwordTooShort")),n(!1);return}await C(r,i,g),d(!0),h(!1),p("")}else await F(r,i)}catch(u){console.error("Auth error:",u);const v=u.message||t("login.err.generic"),w=V(v);l(w?t(w):v)}finally{n(!1)}},T=t(j?"login.forgotSubtitle":o?"login.signUpSubtitle":"login.signInSubtitle");return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-green-50 flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-xl p-8 border border-gray-100",children:[e.jsxs("div",{className:"flex flex-col items-center mb-8",children:[e.jsx("img",{src:"/leap-vu-logo.png",alt:"LEAP-VU logo",className:"h-24 w-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2 text-center",children:"LEAP-VU"}),e.jsx("p",{className:"text-gray-600 text-center",children:T}),e.jsxs("button",{"data-testid":"button-lang-toggle-login",onClick:()=>E(x==="nl"?"en":"nl"),className:"mt-3 flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-lg transition-colors border border-gray-200",children:[e.jsx("span",{children:x==="nl"?"ð³ð± NL":"ð¬ð§ EN"}),e.jsx("span",{children:"â"}),e.jsx("span",{children:x==="nl"?"ð¬ð§ EN":"ð³ð± NL"})]})]}),j?U?e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"bg-green-50 border border-green-200 text-green-800 px-4 py-3 rounded-lg text-sm","data-testid":"text-forgot-sent",children:t("login.forgotSent")}),e.jsx("button",{onClick:()=>{m(!1),b(!1),l("")},className:"w-full text-blue-600 hover:text-blue-700 font-medium transition-colors","data-testid":"button-back-to-login",children:t("login.backToLogin")})]}):e.jsxs("form",{onSubmit:I,className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"forgot-email",className:"block text-sm font-semibold text-gray-700 mb-2",children:t("login.email")}),e.jsxs("div",{className:"relative",children:[e.jsx(N,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{id:"forgot-email",type:"email",value:r,onChange:s=>f(s.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all outline-none",placeholder:t("login.emailPlaceholder"),required:!0,"data-testid":"input-forgot-email"})]})]}),e.jsx("button",{type:"submit",disabled:c,className:"w-full bg-gradient-to-r from-blue-500 to-green-500 text-white font-semibold py-3 rounded-lg hover:from-blue-600 hover:to-green-600 transition-all shadow-lg hover:shadow-xl disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2","data-testid":"button-send-reset",children:c?e.jsx("div",{className:"w-5 h-5 border-2 border-white border-t-transparent rounded-full animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"w-5 h-5"}),t("login.forgotSendBtn")]})}),e.jsx("button",{type:"button",onClick:()=>{m(!1),l("")},className:"w-full text-blue-600 hover:text-blue-700 font-medium transition-colors","data-testid":"button-cancel-forgot",children:t("login.backToLogin")})]}):e.jsxs("form",{onSubmit:P,className:"space-y-5",children:[o&&e.jsxs("div",{children:[e.jsx("label",{htmlFor:"fullName",className:"block text-sm font-semibold text-gray-700 mb-2",children:t("login.fullName")}),e.jsxs("div",{className:"relative",children:[e.jsx(D,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{id:"fullName",type:"text",value:g,onChange:s=>k(s.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all outline-none",placeholder:t("login.fullNamePlaceholder"),required:!0,"data-testid":"input-fullname"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-semibold text-gray-700 mb-2",children:t("login.email")}),e.jsxs("div",{className:"relative",children:[e.jsx(N,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{id:"email",type:"email",value:r,onChange:s=>
11f(s.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all outline-none",placeholder:t("login.emailPlaceholder"),required:!0,"data-testid":"input-email"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-semibold text-gray-700 mb-2",children:t("login.password")}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{id:"password",type:"password",value:i,onChange:s=>p(s.target.value),className:"w-full pl-11 pr-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all outline-none",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",required:!0,minLength:6,"data-testid":"input-password"})]})]}),L&&e.jsx("div",{className:"bg-green-50 border border-green-200 text-green-800 px-4 py-3 rounded-lg text-sm","data-testid":"text-signup-success",children:t("login.signUpSuccess")}),y&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg text-sm","data-testid":"text-login-error",children:y}),e.jsx("button",{type:"submit",disabled:c,className:"w-full bg-gradient-to-r from-blue-500 to-green-500 text-white font-semibold py-3 rounded-lg hover:from-blue-600 hover:to-green-600 transition-all shadow-lg hover:shadow-xl disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2","data-testid":"button-login",children:c?e.jsx("div",{className:"w-5 h-5 border-2 border-white border-t-transparent rounded-full animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"w-5 h-5"}),t(o?"login.signUpBtn":"login.loginBtn")]})}),e.jsxs("div",{className:"space-y-3 text-center",children:[e.jsx("button",{type:"button",onClick:()=>{h(s=>!s),l(""),d(!1)},className:"block w-full text-sm text-blue-600 hover:text-blue-700 font-medium transition-colors","data-testid":"button-toggle-signup",children:t(o?"login.switchToSignIn":"login.switchToSignUp")}),!o&&e.jsx("button",{type:"button",onClick:()=>{m(!0),b(!1),l(""),d(!1)},className:"block w-full text-sm text-blue-600 hover:text-blue-700 font-medium transition-colors","data-testid":"button-forgot-password",children:t("login.forgotLink")})]})]})]})})})}export{J as LoginPage,V as mapAuthErrorToKey};
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.