1import{I as c,N as v,c as e,d as b,ft as d,tt as u,v as P}from"./runtime-core.esm-bundler-BHqpc6Kw.js";import{g as _,h}from"./useApi-BPuI6ZR9-BUFuOkTQ.js";import{s as t,t as g}from"./axios-DzksfLA5.js";import{t as x}from"./useAuth-BQcW12Bq.js";import{Nt as i}from"./index-BopVZjtL.js";var k={class:"bg-base-300 max-w-md mx-auto mt-20 shadow-sm p-6"},y={class:"mb-2"},R={class:"mb-4"},C=["disabled"],V=P({__name:"ResetPasswordView",setup(N){const o=d(""),a=d(""),r=d(!1),w=h(),p=_(),m=x();v(async()=>{await m.logout()});async function f(){if(!o.value||!a.value){t("Please fill in both password fields.");return}if(o.value!==a.value){t("Passwords do not match.");return}const n=w.params.token;if(!n){t("Invalid or missing reset token.");return}r.value=!0;try{await g.post("/auth/reset-password",{token:n,newPassword:o.value}),t("Password reset successful. You can now log in.","success"),p.push("/login")}catch(s){console.error("Reset password error:",s),t(s.response?.data?.error??"We encountered an error.")}finally{r.value=!1}}return(n,s)=>(c(),b("div",k,[s[4]||(s[4]=e("h1",{class:"text-xl font-bold mb-4"},"Reset Password",-1)),e("div",y,[s[2]||(s[2]=e("label",{class:"block text-sm font-medium",for:"reset-password-new"},"New Password",-1)),u(e("input",{id:"reset-password-new",type:"password","onUpdate:modelValue":s[0]||(s[0]=l=>o.value=l),name:"newPassword",class:"input input-bordered w-full",placeholder:"Enter new password",autocomplete:"new-password"},null,512),[[i,o.value]])]),e("div",R,[s[3]||(s[3]=e("label",{class:"block text-sm font-medium",for:"reset-password-confirm"},"Confirm New Password",-1)),u(e("input",{id:"reset-password-confirm",type:"password","onUpdate:modelValue":s[1]||(s[1]=l=>a.value=l),name:"confirmPassword",class:"input input-bordered w-full",placeholder:"Confirm new password",autocomplete:"new-password"},null,512),[[i,a.value]])]),e("button",{class:"btn btn-primary",disabled:r.value,onClick:f,title:"Change Password"},"Change Password",8,C)]))}}),U=V;export{U as default};
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.