1import{u as S,aj as y,r as t,g as c,j as e,H as C,N as E,d as P}from"./index-ifFCWbr-.js";import{C as R}from"./circle-alert-CZKjYOp1.js";import{E as k,a as A}from"./eye-7oo50k2V.js";const O=()=>{const{language:f}=S(),g=y(),s=f==="fr",[u,l]=t.useState(!1),[o,j]=t.useState(""),[m,N]=t.useState(""),[n,w]=t.useState(!1),[p,d]=t.useState(null),[i,x]=t.useState(null),[h,b]=t.useState(!1);t.useEffect(()=>{const{data:{subscription:r}}=c.auth.onAuthStateChange(a=>{(a==="PASSWORD_RECOVERY"||a==="SIGNED_IN")&&l(!0)});return c.auth.getSession().then(({data:{session:a}})=>{a&&l(!0)}),()=>r.unsubscribe()},[]);const v=async r=>{if(r.preventDefault(),d(null),x(null),o.length<8){d(s?"Le mot de passe doit contenir au moins 8 caractères":"Password must be at least 8 characters");return}if(o!==m){d(s?"Les mots de passe ne correspondent pas":"Passwords do not match");return}b(!0);const{error:a}=await c.auth.updateUser({password:o});if(b(!1),a){d(a.message);return}x(s?"Mot de passe mis à jour. Redirection...":"Password updated. Redirecting..."),setTimeout(()=>g("/admin"),1500)};return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(C,{}),e.jsx("main",{className:"pt-32 pb-16",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"max-w-md mx-auto",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("span",{className:"section-label",children:"Administration"}),e.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-4",children:s?"Nouveau mot de passe":"New password"}),e.jsx("p",{className:"text-muted-foreground",children:s?"Choisissez un nouveau mot de passe pour votre compte":"Choose a new password for your account"})]}),e.jsxs("form",{onSubmit:v,className:"card-festival p-8 space-y-6",children:[p&&e.jsxs("div",{className:"flex items-center gap-2 p-4 bg-destructive/10 border border-destructive/30 text-sm",children:[e.jsx(R,{className:"w-4 h-4 text-destructive"}),e.jsx("span",{children:p})]}),i&&e.jsx("div",{className:"p-4 bg-primary/10 border border-primary/30 text-sm",children:i}),!u&&!i&&e.jsx("div",{className:"p-4 border border-border text-sm text-muted-foreground",children:s?"Validation du lien en cours...":"Validating reset link..."}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs uppercase tracking-widest text-muted-foreground mb-2",children:s?"Nouveau mot de passe":"New password"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:n?"text":"password",value:o,onChange:r=>j(r.target.value),className:"w-full bg-transparent border border-border px-4 py-3 pr-12 text-sm focus:outline-none focus:border-foreground transition-colors",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",required:!0,minLength:8}),e.jsx("button",{type:"button",onClick:()=>w(!n),className:"absolute right-4 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:n?e.jsx(k,{className:"w-4 h-4"}):e.jsx(A,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs uppercase tracking-widest text-muted-foreground mb-2",children:s?"Confirmer le mot de passe":"Confirm password"}),e.jsx("input",{type:n?"text":"password",value:m,onChange:r=>N(r.target.value),className:"w-full bg-transparent border border-border px-4 py-3 text-sm focus:outline-none focus:border-foreground transition-colors",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",required:!0,minLength:8})]}),e.jsx(E,{type:"submit",variant:"filled",className:"w-full",disabled:h||!u,children:h?s?"Mise à jour...":"Updating...":s?"Mettre à jour":"Update password"})]})]})})}),e.jsx(P,{})]})};export{O as default};
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.