import{C as e,E as t,T as n,X as r,b as i,f as a,l as o,p as s,s as c,t as l,u}from"./_plugin-vue_export-helper-CfRVXrSo.js";import{a as d,r as f}from"./runtime-dom.esm-bundler-DdqN-WFI.js";import{i as p}from"./router-PO6YAHA1.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(l,p,m,y,b,x){let S=e(`router-link`);return i(),u(`div`,h,[p[7]||=c(`h2`,null,`Neues Passwort setzen`,-1),c(`form`,{onSubmit:p[2]||=d((...e)=>x.submitResetPassword&&x.submitResetPassword(...e),[`prevent`])},[p[4]||=c(`label`,{for:`password`},`Neues Passwort:`,-1),t(c(`input`,{type:`password`,id:`password`,"onUpdate:modelValue":p[0]||=e=>b.password=e,required:``,minlength:`6`},null,512),[[f,b.password]]),p[5]||=c(`label`,{for:`confirmPassword`},`Passwort bestätigen:`,-1),t(c(`input`,{type:`password`,id:`confirmPassword`,"onUpdate:modelValue":p[1]||=e=>b.confirmPassword=e,required:``,minlength:`6`},null,512),[[f,b.confirmPassword]]),c(`button`,{type:`submit`,disabled:!x.isFormValid},`Passwort zurücksetzen`,8,g)],32),c(`p`,null,[s(S,{to:`/login`},{default:n(()=>[...p[6]||=[a(`Zurück zum Login`,-1)]]),_:1})]),b.dialogVisible?(i(),u(`div`,_,[c(`div`,v,[c(`h3`,null,r(b.dialogTitle),1),c(`p`,null,r(b.dialogMessage),1),c(`button`,{type:`button`,onClick:p[3]||=(...e)=>x.closeDialog&&x.closeDialog(...e)},`Schließen`)])])):o(``,!0)])}var b=l(m,[[`render`,y],[`__scopeId`,`data-v-3a4e9538`]]);export{b as default};
//# sourceMappingURL=ResetPasswordContent-CP3VIRUx.js.map