1import{r as c,u as g,a as j,j as e,k as h,a$ as b,b0 as w,B as P,b2 as k}from"./main-D_O6oYJZ.js";import{I as v,aa as z,w as C}from"./mdi-Trl8lzqZ.js";import{u as N}from"./use-mutation-C1kgs0zg.js";import{u as y}from"./provider-CzuPbNSG.js";import"./useMutation-DJejziiJ.js";function E({token:l}){const t=y(),[s,o]=c.useState(""),[i,a]=c.useState(null),f=g(),u=j(),d=N({...f.posts.changePassword.mutationOptions(),messages:{success:t("Dein Passwort wurde erfolgreich geändert."),error:t("Fehler beim Ãndern des Passworts.")},onSuccess:()=>{u({to:"/"})}}),x=r=>r.length<8?t("Mindestens 8 Zeichen erforderlich."):/[A-Z]/.test(r)?/[a-z]/.test(r)?/[0-9]/.test(r)?null:t("Mindestens 1 Zahl erforderlich."):t("Mindestens 1 Kleinbuchstabe erforderlich."):t("Mindestens 1 GroÃbuchstabe erforderlich."),n=!!s.trim().length,p=()=>{if(!n)return;const r=x(s);if(r){a(r);return}a(null),d.mutate({currentPassword:l,newPassword:s})},m=d.isPending;return e.jsxs("div",{className:"flex flex-col gap-4 w-full max-w-140 px-4 z-30",children:[e.jsxs("div",{className:h("flex gap-3 bg-gray-200 rounded-full h-16 justify-end w-full transition border-2",i?"border-red-500":"border-transparent"),children:[e.jsx("input",{type:"password",placeholder:t("Neues Passwort eingeben"),className:h("h-full rounded-full bg-transparent outline-none pl-6 placeholder:text-gray-500 placeholder:font-medium font-medium grow text-xl min-w-0"),value:s,onChange:r=>{o(r.target.value),i&&a(null)},onKeyDown:r=>{r.key==="Enter"&&n&&p()},disabled:m,autoFocus:!0}),e.jsx("button",{className:h("h-full aspect-square p-0 rounded-full flex items-center justify-center text-white transition",n&&!m?"bg-purple-accent hover:bg-purple-accent/80":"bg-purple-accent/50 cursor-default"),onClick:p,disabled:!n||m,children:m?e.jsx(b,{animationData:w,loop:!0,autoplay:!0,style:{cursor:"default",width:"100%",height:"100%"}}):e.jsx(v,{path:z,size:1.2})})]}),e.jsx("div",{className:"text-center min-h-6",children:i&&e.jsx("p",{className:"text-red-500 font-medium text-sm animate-in fade-in slide-in-from-top-1",children:i})}),e.jsx("div",{className:"text-center mt-2",children:e.jsx("button",{className:"text-gray-500 hover:text-purple-accent text-sm font-medium transition disabled:text-gray-400",onClick:()=>u({to:"/auth/sign-in"}),children:t("Zurück zum Login")})})]})}function S({token:l,userId:t}){const s=y(),[o,i]=c.useState(!1),[a,f]=c.useState(null),u=g(),d=j(),x=N({...u.auth.loginByResetToken.mutationOptions(),onSuccess:()=>{i(!0)},onError:n=>{console.log(n),f(s("Der Link ist ungültig oder abgelaufen."))},messages:{error:null}});return c.useEffect(()=>{let n=!0;return n&&!x.isPending&&!o&&!a&&x.mutate({token:l,userId:t}),()=>{n=!1}},[l,t]),e.jsx("div",{className:"flex flex-col h-full w-full overflow-y-auto",children:e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center px-4 py-6 gap-6",children:[e.jsxs("div",{className:"flex flex-col items-center w-full",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-bold text-center mb-6 bg-linear-to-r from-purple-800 via-purple-600 to-purple-800 bg-clip-text text-transparent font-extrabold",children:s("Passwort zurücksetzen")}),e.jsx("p",{className:"text-lg md:text-xl text-center text-gray-600 max-w-2xl font-medium",children:s("Gib dein neues, sicheres Passwort ein")})]}),!o&&!a&&e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("div",{className:"w-24 h-24",children:e.jsx(b,{animationData:w,loop:!0,autoplay:!0})}),e.jsx("p",{className:"text-gray-600 font-medium",children:s("Ãberprüfe Link...")})]}),a&&e.jsxs("div",{className:"flex flex-col items-center gap-6 max-w-md text-center",children:[e.jsx("div",{className:"w-16 h-16 text-red-500 bg-red-100 rounded-full flex items-center justify-center",children:e.jsx(v,{path:C,size:1.5})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-800 mb-2",children:s("Fehler")}),e.jsx("p",{className:"text-gray-600",children:a})]}),e.jsx(P,{onClick:()=>d({to:"/auth/sign-in"}),className:"mt-4 h-12 px-6",children:s("Zurück zum Login")})]}),o&&e.jsx(E,{token:l})]})})}function Z(){const{token:l,userId:t}=k.useSearch();return e.jsx("div",{className:"relative w-screen h-screen overflow-hidden",children:e.jsx(S,{token:l,userId:t})})}
1export{Z as component};
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.