import{a as y,b as _,g as b,h as Q,i as x,j as s,m as n,k as e,F as V,a3 as u,v as p,I as k,J as f,y as C,Q as P,p as c,D as v,K as h}from"./index-DAvBaevK.js";import{Q as B}from"./QForm-CgLsd63I.js";import{Q as I}from"./QPage-B68JuyjH.js";import{u as L}from"./use-quasar-B5tVCAcV.js";import{l as S}from"./api-RGUeM09o.js";import{_ as A}from"./_plugin-vue_export-helper-DlAUqK2U.js";const E={class:"auth-shell"},N=y({__name:"LoginPage",setup(F){const g=_(),d=L(),i=v(!1),r=v(!1),o=h({username:"",password:""});async function w(){i.value=!0;try{const t=await S({username:o.username.trim(),password:o.password});if(t.error)throw new Error(t.error);d.notify({type:"positive",message:"Login effettuato."}),await g.push("/")}catch(t){d.notify({type:"negative",message:t instanceof Error?t.message:String(t)})}finally{i.value=!1}}return(t,a)=>{const m=b("router-link");return Q(),x(I,{class:"auth-page"},{default:s(()=>[n("div",E,[e(V,{flat:"",bordered:"",class:"auth-card"},{default:s(()=>[e(u,null,{default:s(()=>[...a[3]||(a[3]=[n("div",{class:"text-overline text-primary"},"Accesso",-1),n("div",{class:"text-h4"},"Login",-1),n("div",{class:"text-body2 text-grey-7"},"Accedi con email e password.",-1)])]),_:1}),e(p),e(u,null,{default:s(()=>[e(B,{class:"auth-form",onSubmit:k(w,["prevent"])},{default:s(()=>[e(f,{modelValue:o.username,"onUpdate:modelValue":a[0]||(a[0]=l=>o.username=l),outlined:"",type:"email",label:"Email",autocomplete:"username"},null,8,["modelValue"]),e(f,{modelValue:o.password,"onUpdate:modelValue":a[2]||(a[2]=l=>o.password=l),outlined:"",type:r.value?"text":"password",label:"Password",autocomplete:"current-password"},{append:s(()=>[e(C,{name:r.value?"visibility_off":"visibility",class:"cursor-pointer",onClick:a[1]||(a[1]=l=>r.value=!r.value)},null,8,["name"])]),_:1},8,["modelValue","type"]),e(P,{color:"primary",label:"Accedi",type:"submit",loading:i.value},null,8,["loading"])]),_:1})]),_:1}),e(p),e(u,{class:"auth-links"},{default:s(()=>[e(m,{to:"/recoverpassword"},{default:s(()=>[...a[4]||(a[4]=[c("Password dimenticata?",-1)])]),_:1}),e(m,{to:"/signup"},{default:s(()=>[...a[5]||(a[5]=[c("Crea account",-1)])]),_:1})]),_:1})]),_:1})])]),_:1})}}}),K=A(N,[["__scopeId","data-v-e726952b"]]);export{K as default};
