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