import{u as _,a as y,c as b,r as V,o as i,b as u,d as s,w as h,e as r,f as d,t as k,g as P,h as m,i as c,j as S,_ as p,k as v,l as R}from"./index-9538feb4.js";const C={class:"min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8"},N={class:"max-w-md w-full space-y-8"},q={class:"rounded-md shadow-sm space-y-4"},B={key:0,class:"rounded-md bg-red-50 p-4"},E={class:"text-sm text-red-700"},j={class:"text-center"},$={__name:"Login",setup(D){_();const f=y(),t=c(!1),o=c(""),a=S({email:"",password:""}),x=b({url:"login",makeParams(){return{usr:a.email,pwd:a.password}},onSuccess(){t.value=!1,o.value="";const l=f.query.redirect||"/sites";window.location.href="/portal"+l},onError(l){var e;t.value=!1,o.value=((e=l.messages)==null?void 0:e[0])||l.message||"Invalid email or password"}});function g(){if(!a.email||!a.password){o.value="Please enter email and password";return}o.value="",t.value=!0,x.submit()}return(l,e)=>{const w=V("router-link");return i(),u("div",C,[s("div",N,[e[4]||(e[4]=s("div",null,[s("h2",{class:"mt-6 text-center text-3xl font-extrabold text-gray-900"}," Cloud Portal "),s("p",{class:"mt-2 text-center text-sm text-gray-600"}," Sign in to your account ")],-1)),s("form",{class:"mt-8 space-y-6",onSubmit:h(g,["prevent"])},[s("div",q,[r(d(p),{label:"Email",type:"email",modelValue:a.email,"onUpdate:modelValue":e[0]||(e[0]=n=>a.email=n),placeholder:"you@example.com",disabled:t.value,required:""},null,8,["modelValue","disabled"]),r(d(p),{label:"Password",type:"password",modelValue:a.password,"onUpdate:modelValue":e[1]||(e[1]=n=>a.password=n),placeholder:"Password",disabled:t.value,required:""},null,8,["modelValue","disabled"])]),o.value?(i(),u("div",B,[s("p",E,k(o.value),1)])):P("",!0),s("div",null,[r(d(R),{type:"submit",variant:"solid",class:"w-full",loading:t.value},{default:m(()=>[...e[2]||(e[2]=[v(" Sign in ",-1)])]),_:1},8,["loading"])]),s("div",j,[r(w,{to:{name:"Register"},class:"text-sm text-blue-600 hover:text-blue-500"},{default:m(()=>[...e[3]||(e[3]=[v(" Don't have an account? Sign up ",-1)])]),_:1})])],32)])])}}};export{$ as default};
//# sourceMappingURL=Login-2d17b53c.js.map
