PageSourceSearch

https://codir.pro/assets/ResetPassword-CiHzIWa2.js

js codir.pro collected 2026-10-02 02:06:34 UTC 2,437 bytes, 1 lines download raw bytes

1import{u as b,r,j as e,L as y,v,b as j}from"./index-B0sM48fE.js";import{A as c,a as m}from"./AuthInput-9rhwaw4R.js";import{C}from"./circle-check-CxxoOG2b.js";import"./eye-off-CNUKsdly.js";function k(){const p=b(),n=r.useMemo(()=>{const t=new URLSearchParams(window.location.search);return t.get("token")||t.get("resetToken")||""},[]),[i,f]=r.useState(""),[l,x]=r.useState(""),[o,u]=r.useState(!1),[d,a]=r.useState(""),[h,g]=r.useState(!1),w=async t=>{if(t.preventDefault(),a(""),i.length<8){a("Le mot de passe doit contenir au moins 8 caractères.");return}if(i!==l){a("Les mots de passe ne correspondent pas.");return}if(!n){a("Lien de réinitialisation invalide ou expiré.");return}u(!0);try{await j.auth.resetPassword({resetToken:n,newPassword:i}),g(!0),setTimeout(()=>p("/signin",{replace:!0}),2e3)}catch(s){(s==null?void 0:s.status)===400?a("Lien invalide ou expiré. Demande-en un nouveau."):(s==null?void 0:s.status)===422?a("Le mot de passe ne respecte pas les critères de sécurité."):a((s==null?void 0:s.message)||"Impossible de réinitialiser le mot de passe."),u(!1)}};return h?e.jsx(c,{title:"Mot de passe mis à jour",subtitle:"Redirection vers la connexion…",children:e.jsx("div",{className:"flex flex-col items-center gap-4 py-4",children:e.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/20 flex items-center justify-center",children:e.jsx(C,{className:"w-8 h-8 text-primary"})})})}):e.jsx(c,{title:"Nouveau mot de passe",subtitle:"Choisis un mot de passe sécurisé",footer:e.jsx(v,{to:"/signin",className:"text-primary hover:text-primary/80 font-medium",children:"Retour à la connexion"}),children:e.jsxs("form",{onSubmit:w,className:"space-y-4",children:[e.jsx(m,{label:"Nouveau mot de passe",type:"password",value:i,onChange:t=>f(t.target.value),placeholder:"Minimum 8 caractères",autoComplete:"new-password",required:!0,disabled:o}),e.jsx(m,{label:"Confirmer le mot de passe",type:"password",value:l,onChange:t=>x(t.target.value),placeholder:"Ressaisis ton mot de passe",autoComplete:"new-password",required:!0,disabled:o}),d&&e.jsx("p",{className:"text-sm text-red-400",children:d}),e.jsxs("button",{type:"submit",disabled:o,className:"w-full py-3 bg-primary hover:bg-primary/90 text-primary-foreground font-bold rounded-xl transition disabled:opacity-50 flex items-center justify-center gap-2",children:[o&&e.jsx(y,{className:"w-4 h-4 animate-spin"}),"Réinitialiser"]})]})})}export{k 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.