import{M as e,O as t,c as n,ct as r,d as i,h as a,j as o,m as s,t as c,u as l,w as u}from"./_plugin-vue_export-helper-Conii5fq.js";import{a as d,c as f}from"./runtime-dom.esm-bundler-CI28bPhn.js";import{i as p}from"./router-Cubu3_vL.js";var m={name:`ResetPasswordComponent`,data(){return{password:``,confirmPassword:``,token:``,dialogTitle:``,dialogMessage:``,dialogVisible:!1}},computed:{isFormValid(){return this.password.length>=6&&this.password===this.confirmPassword&&this.token}},mounted(){this.token=new URLSearchParams(window.location.search).get(`token`),this.token||this.showDialog(`Fehler`,`Ungültiger Reset-Link. Bitte fordern Sie einen neuen Link an.`)},methods:{async submitResetPassword(){if(this.password!==this.confirmPassword){this.showDialog(`Fehler`,`Die Passwörter stimmen nicht überein.`);return}try{let e=await p.post(`/auth/reset-password`,{token:this.token,password:this.password});this.showDialog(`Erfolg`,e.data?.message||`Passwort erfolgreich zurückgesetzt. Sie können sich jetzt anmelden.`),this.password=``,this.confirmPassword=``,setTimeout(()=>{this.$router.push(`/auth/login`)},3e3)}catch(e){let t=e?.response?.data?.message||e?.message||`Ein unbekannter Fehler ist aufgetreten`;this.showDialog(`Fehler`,t)}},showDialog(e,t){this.dialogTitle=e,this.dialogMessage=t,this.dialogVisible=!0},closeDialog(){this.dialogVisible=!1}}},h={class:`reset-password`},g=[`disabled`],_={key:0,class:`dialog`},v={class:`dialog-content`};function y(c,p,m,y,b,x){let S=t(`router-link`);return u(),i(`div`,h,[p[7]||=n(`h2`,null,`Neues Passwort setzen`,-1),n(`form`,{onSubmit:p[2]||=f((...e)=>x.submitResetPassword&&x.submitResetPassword(...e),[`prevent`])},[p[4]||=n(`label`,{for:`password`},`Neues Passwort:`,-1),e(n(`input`,{type:`password`,id:`password`,"onUpdate:modelValue":p[0]||=e=>b.password=e,required:``,minlength:`6`},null,512),[[d,b.password]]),p[5]||=n(`label`,{for:`confirmPassword`},`Passwort bestätigen:`,-1),e(n(`input`,{type:`password`,id:`confirmPassword`,"onUpdate:modelValue":p[1]||=e=>b.confirmPassword=e,required:``,minlength:`6`},null,512),[[d,b.confirmPassword]]),n(`button`,{type:`submit`,disabled:!x.isFormValid},`Passwort zurücksetzen`,8,g)],32),n(`p`,null,[a(S,{to:`/login`},{default:o(()=>[...p[6]||=[s(`Zurück zum Login`,-1)]]),_:1})]),b.dialogVisible?(u(),i(`div`,_,[n(`div`,v,[n(`h3`,null,r(b.dialogTitle),1),n(`p`,null,r(b.dialogMessage),1),n(`button`,{type:`button`,onClick:p[3]||=(...e)=>x.closeDialog&&x.closeDialog(...e)},`Schließen`)])])):l(``,!0)])}var b=c(m,[[`render`,y],[`__scopeId`,`data-v-3a4e9538`]]);export{b as default};
//# sourceMappingURL=ResetPasswordContent-a4tvQ985.js.map