PageSourceSearch

https://truthlens.pro/assets/ResetPassword-Byjvq7F5.js

js truthlens.pro collected 2026-10-02 02:08:17 UTC 6,164 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-trpc-DCcAlI5q.js";import{u as q,h as A,r as c,L as d}from"./vendor-react-D5r-IlYS.js";import{t as u,f as x,B as m,L as h,a2 as M,z as p,I as f,a5 as j,E as g,C as N,i as B}from"./index-Dqu5qgeY.js";import{C as b}from"./circle-x-BZMcOFdE.js";import{K as w}from"./key-round-LY-5V6lH.js";import"./vendor-markdown-fNldIaJy.js";import"./vendor-radix-Cu6bALrx.js";import"./vendor-charts-DMCz1ErY.js";import"./vendor-i18n-CocHSt1v.js";function X(){const[,v]=q(),y=A(),i=new URLSearchParams(y).get("token")??"",[o,C]=c.useState(!1),[l,L]=c.useState(!1),[t,k]=c.useState(""),[r,S]=c.useState(""),{data:P,isLoading:R}=u.auth.checkResetToken.useQuery({token:i},{enabled:!!i}),a=u.auth.resetPassword.useMutation({onSuccess:()=>{x.success("Mot de passe réinitialisé avec succès !"),v("/dashboard")},onError:s=>{x.error(s.message)}}),E=s=>{if(s.preventDefault(),t!==r){x.error("Les mots de passe ne correspondent pas.");return}a.mutate({token:i,password:t})},n=(()=>{if(!t)return 0;let s=0;return t.length>=8&&s++,/[A-Z]/.test(t)&&s++,/[0-9]/.test(t)&&s++,/[^A-Za-z0-9]/.test(t)&&s++,s})(),z=["","bg-red-500","bg-amber-500","bg-cyan-500","bg-emerald-500"][n],F=["","Faible","Moyen","Bon","Excellent"][n];return i?R?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(h,{className:"w-6 h-6 animate-spin text-primary"})}):P?.valid?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-6",children:e.jsxs("div",{className:"w-full max-w-md 
1space-y-8",children:[e.jsx(d,{href:"/",className:"flex justify-center",children:e.jsx(M,{variant:"principal",iconSize:32,textSize:"text-xl"})}),e.jsxs("div",{children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/20 border border-primary/30 flex items-center justify-center mb-4",children:e.jsx(w,{className:"w-6 h-6 text-primary"})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Nouveau mot de passe"}),e.jsx("p",{className:"mt-1 text-muted-foreground text-sm",children:"Choisissez un mot de passe fort pour sécuriser votre compte."})]}),e.jsxs("form",{onSubmit:E,className:"space-y-5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(p,{htmlFor:"password",children:"Nouveau mot de passe"}),e.jsxs("div",{className:"relative",children:[e.jsx(f,{id:"password",type:o?"text":"password",placeholder:"8 caractères minimum",value:t,onChange:s=>k(s.target.value),required:!0,minLength:8,className:"h-11 pr-10",autoComplete:"new-password"}),e.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>C(s=>!s),"aria-label":o?"Masquer le mot de passe":"Afficher le mot de passe","aria-pressed":o,children:o?e.jsx(j,{className:"w-4 h-4"}):e.jsx(g,{className:"w-4 h-4"})})]}),t&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3,4].map(s=>e.jsx("div",{className:`h-1 flex-1 rounded-full transition-colors ${s<=n?z:"bg-border"}`},s))}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Force : ",e.jsx("span",{className:`font-medium ${n>=3?"text-emerald-400":n===2?"text-amber-400":"text-red-400"}`,children:F})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(p,{htmlFor:"confirm",children:"Confirmer le mot de passe"}),e.jsxs("div",{className:"relative",children:[e.jsx(f,{id:"confirm",type:l?"text":"password",placeholder:"Répétez le mot de passe",value:r,onChange:s=>S(s.target.value),required:!0,className:"h-11 pr-10",autoComplete:"new-password"}),e.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>L(s=>!s),"aria-label":l?"Masquer la confirmation":"Afficher la confirmation","aria-pressed":l,children:l?e.jsx(j,{className:"w-4 h-4"}):e.jsx(g,{className:"w-4 h-4"})})]}),r&&t!==r&&e.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[e.jsx(N,{className:"w-3 h-3"}),"Les mots de passe ne correspondent pas"]}),r&&t===r&&t.length>=8&&e.jsxs("p",{className:"text-xs text-emerald-400 flex items-center gap-1",children:[e.jsx(B,{className:"w-3 h-3"}),"Les mots de passe correspondent"]})]}),a.error&&e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm",children:[e.jsx(N,{className:"w-4 h-4 shrink-0"}),a.error.message]}),e.jsx(m,{type:"submit",className:"w-full h-11 font-semibold",disabled:a.isPending||t!==r||t.length<8,children:a.isPending?e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"w-4 h-4 mr-2 animate-spin"}),"Réinitialisation…"]}):e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"w-4 h-4 mr-2"}),"Réinitialiser le mot de passe"]})})]})]})}):e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center space-y-4 max-w-sm",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-red-500/20 border border-red-500/30 flex items-center justify-center mx-auto",children:e.jsx(b,{className:"w-8 h-8 text-red-400"})}),e.jsx("h1",{className:"text-xl font-bold text-foreground",children:"Lien expiré"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Ce lien de réinitialisation a expiré ou a déjà été utilisé. Les liens sont valables 1 heure."}),e.jsx(d,{href:"/forgot-password",children:e.jsx(m,{className:"w-full",children:"Demander un nouveau lien"})}),e.jsx(d,{href:"/login",children:e.jsx(m,{variant:"ghost",className:"w-full text-muted-foreground",children:"Retour à la connexion"})})]})}):e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx(b,{className:"w-12 h-12 text-red-400 mx-auto"}),e.jsx("h1",{className:"text-xl font-bold text-foreground",children:"Lien invalide"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Ce lien de réinitialisation est invalide ou manquant."}),e.jsx(d,{href:"/forgot-password",children:e.jsx(m,{children:"Demander un nouveau lien"})})]})})}export{X 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.