1import{f as v,r as t,d as o,j as e,s as P,t as a}from"./index-CrlHD_rY.js";import{B as p}from"./button-C9mq-HB0.js";import{I as h}from"./input-C_5ShHgB.js";import{L as x}from"./label-C1DSNaZ-.js";import{P as y}from"./public-layout-Dgt4YvtQ.js";import{l as k}from"./cookie-banner-CZ9Vfr7P.js";import"./utils-CsI7vFqD.js";import"./clsx-B-dksMZM.js";import"./x-DbwQtEZ-.js";import"./createLucideIcon-D7E4aMTN.js";import"./users-CQ1L-uez.js";import"./mail-B_NaO__j.js";function I(){const i=v(),[r,f]=t.useState(""),[d,g]=t.useState(""),[l,u]=t.useState(!1),[w,c]=t.useState(null);t.useEffect(()=>{let s=!0;(async()=>{const{data:m}=await o.auth.getSession();s&&c(!!m.session)})();const{data:b}=o.auth.onAuthStateChange((m,N)=>{N&&c(!0)});return()=>{s=!1,b.subscription.unsubscribe()}},[]);const j=async s=>{if(s.preventDefault(),r.length<8)return a.error("Das Passwort muss mindestens 8 Zeichen haben.");if(r!==d)return a.error("Die Passwörter stimmen nicht überein.");u(!0);const{error:n}=await o.auth.updateUser({password:r});if(u(!1),n)return a.error(n.message);a.success("Passwort geändert â du bist jetzt angemeldet."),i({to:"/spiel/dashboard"})};return e.jsx(y,{children:e.jsx("section",{className:"mx-auto grid min-h-[calc(100vh-8rem)] max-w-md place-items-center px-4 py-12 sm:px-6",children:e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("img",{src:k.url,alt:`${P.name} Logo`,width:642,height:226,className:"mx-auto h-20 w-auto"}),e.jsx("h1",{className:"mt-5 font-display text-3xl font-bold",children:"Neues Passwort festlegen"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Wähle ein neues Passwort für dein Konto â danach bist du direkt angemeldet."})]}),e.jsx("div",{className:"mt-8 rounded-3xl border border-border bg-card p-6 shadow-soft sm:p-8",children:w===!1?e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-semibold text-foreground",children:"Link ungültig oder abgelaufen"}),e.jsx("p",{className:"mt-2",children:"Bitte fordere auf der Anmeldeseite einen neuen Link an â die Links sind aus Sicherheitsgründen nur kurze Zeit gültig."}),e.jsx(p,{className:"mt-4 rounded-full",onClick:()=>i({to:"/auth"}),children:"Zur Anmeldung"})]}):e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(x,{htmlFor:"pw",children:"Neues Passwort"}),e.jsx(h,{id:"pw",type:"password",autoComplete:"new-password",value:r,onChange:s=>f(s.target.value),required:!0}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Mindestens 8 Zeichen."})]}),e.jsxs("div",{children:[e.jsx(x,{htmlFor:"pw2",children:"Passwort wiederholen"}),e.jsx(h,{id:"pw2",type:"password",autoComplete:"new-password",value:d,onChange:s=>g(s.target.value),required:!0})]}),e.jsx(p,{type:"submit",className:"w-full rounded-full",disabled:l,children:l?"...":"Passwort speichern"})]})})]})})})}export{I 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.