1 line
No EOL
4.2 KiB
JavaScript
1 line
No EOL
4.2 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,54858,e=>{"use strict";let s="/api/v1";async function t(e,s){let t=await e.text();if(!t)return s;try{let e=JSON.parse(t);return e.detail??e.message??t}catch{return t}}async function r(e,s){let t=await fetch("/api/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:s}),credentials:"include"});if(!t.ok){let e=Error(await t.text()||`HTTP ${t.status}`);throw e.status=t.status,e}return t.json()}async function a(e,t){let r=await fetch(`${s}${e}`,{cache:"no-store",credentials:"include"});if(!r.ok)throw Error(`API request failed: ${r.status}`);return r.json()}async function n(e,r,a,n){let i=await fetch(`${s}${e}`,{method:a,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),credentials:"include"});if(!i.ok)throw Error(await t(i,`API request failed: ${i.status}`));return i.json()}async function i(e,r){let a=await fetch(`${s}${e}`,{method:"DELETE",credentials:"include"});if(!a.ok)throw Error(await t(a,`API request failed: ${a.status}`))}async function o(e,r,a){let n=await fetch(`${s}${e}`,{...a,headers:{"Content-Type":"application/json",...a?.headers??{}},credentials:"include"});if(!n.ok)throw Error(await t(n,`API request failed: ${n.status}`));return n.json()}e.s(["API_BASE",0,s,"apiDelete",0,i,"apiFetch",0,o,"apiGet",0,a,"apiSend",0,n,"login",0,r,"normalizeValidationPayload",0,function(e){return{...e,...Object.fromEntries(["contact_id","examiner_id"].map(s=>[s,e[s]||null]))}}])},53155,e=>{"use strict";var s=e.i(43476),t=e.i(94814);let r=(0,e.i(75254).default)("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);var a=e.i(71645),n=e.i(53145),i=e.i(50270),o=e.i(28779),l=e.i(54858);let d=i.z.object({current_password:i.z.string().min(1,"Aktuelles Passwort erforderlich"),new_password:i.z.string().min(12,"Mindestens 12 Zeichen"),new_password_confirmation:i.z.string().min(12,"Mindestens 12 Zeichen")}).refine(e=>e.new_password===e.new_password_confirmation,{path:["new_password_confirmation"],message:"Die neuen Passwoerter stimmen nicht ueberein"});e.s(["default",0,function(){let{token:e,refreshUser:i}=(0,o.useAuth)(),[c,u]=(0,a.useState)(""),h=(0,n.useForm)({resolver:(0,t.zodResolver)(d),defaultValues:{current_password:"",new_password:"",new_password_confirmation:""}});async function m(s){await (0,l.apiFetch)("/auth/change-password",e??"",{method:"POST",body:JSON.stringify(s)}),u("Passwort erfolgreich geaendert"),h.reset(),i()}return(0,s.jsxs)("div",{className:"mx-auto max-w-xl",children:[(0,s.jsxs)("header",{className:"mb-6",children:[(0,s.jsx)("h1",{className:"text-3xl font-semibold text-text",children:"Sicherheit"}),(0,s.jsx)("p",{className:"mt-2 text-text-light",children:"Hier aenderst du dein Passwort."})]}),(0,s.jsxs)("form",{onSubmit:h.handleSubmit(m),className:"space-y-4 rounded-lg border border-border bg-surface p-6 shadow-soft",children:[(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"text-sm font-medium",children:"Aktuelles Passwort"}),(0,s.jsx)("input",{type:"password",...h.register("current_password"),className:"mt-2 h-12 w-full rounded-lg border border-border px-4"})]}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"text-sm font-medium",children:"Neues Passwort"}),(0,s.jsx)("input",{type:"password",...h.register("new_password"),className:"mt-2 h-12 w-full rounded-lg border border-border px-4"})]}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"text-sm font-medium",children:"Neues Passwort wiederholen"}),(0,s.jsx)("input",{type:"password",...h.register("new_password_confirmation"),className:"mt-2 h-12 w-full rounded-lg border border-border px-4"})]}),c&&(0,s.jsx)("div",{className:"rounded-lg border border-success/30 bg-white p-3 text-sm text-success shadow-soft",children:c}),(0,s.jsx)("div",{className:"flex justify-end",children:(0,s.jsxs)("button",{type:"submit",className:"btn btn-primary h-12",children:[(0,s.jsx)(r,{className:"h-4 w-4"})," Passwort ändern"]})})]})]})}],53155)}]); |