PageSourceSearch

https://truthlens.pro/assets/TwoFactorChallenge-XfxkGPxq.js

js truthlens.pro collected 2026-10-02 02:08:20 UTC 5,931 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-trpc-DCcAlI5q.js";import{u as P,r as l,L as R}from"./vendor-react-D5r-IlYS.js";import{t as x,f as h,O as N,Q as y,S as f,V as b,W as C,Y as X,B as w,a2 as O,z as T,I as U,a5 as D,E as q,L as B}from"./index-Dqu5qgeY.js";import{A as I,a as K}from"./alert-DPwciw5X.js";import{A as S}from"./arrow-left-d1wKtkPx.js";import{M as G}from"./mail-CzPeZU73.js";import{K as H}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 ae(){const[,p]=P(),[a,n]=l.useState(""),[s,z]=l.useState(!1),[i,k]=l.useState(!1),[j,o]=l.useState(null),d=new URLSearchParams(window.location.search),u=d.get("token")??"",E=d.get("return")??"/dashboard",r=d.get("m")==="email",g=()=>{h.success("Connexion réussie !"),window.location.href=E},v=t=>{o(t.message),n("")},L=x.twoFactor.verifyChallenge.useMutation({onSuccess:g,onError:v}),V=x.auth.verifyEmailOtp.useMutation({onSuccess:g,onError:v}),c=r?V:L,m=x.auth.resendLoginOtp.useMutation({onSuccess:()=>h.success("Nouveau code envoyé par email."),onError:t=>h.error(t.message)});if(!u)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(N,{className:"w-full max-w-md",children:[e.jsxs(y,{className:"text-center",children:[e.jsx(f,{className:"h-12 w-12 text-destructive mx-auto mb-2"}),e.jsx(b,{children:"Lien invalide"}),e.jsx(C,{children:"Ce lien de vérification est invalide ou expiré."})]}),e.jsx(X,{children:e.jsxs(w,{className:"w-full",onClick:()=>p("/login"),children:[e.jsx(S,{className:"h-4 w-4 mr-2"}),"Retour à la connexion"]})})]})});const A=t=>
1{t.preventDefault(),a.trim()&&(o(null),c.mutate({pendingToken:u,code:a.trim()}))},F=t=>{if(o(null),s)n(t.toUpperCase());else{const M=t.replace(/\D/g,"").slice(0,6);n(M)}};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs("div",{className:"w-full max-w-md space-y-4",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx(R,{href:"/",className:"inline-block",children:e.jsx(O,{variant:"principal",iconSize:32,textSize:"text-xl"})}),e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:e.jsx(f,{className:"h-8 w-8 text-primary"})})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Vérification en deux étapes"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:r?"Un code de connexion à 6 chiffres vient de vous être envoyé par email.":"Votre compte est protégé par la 2FA."})]}),e.jsxs(N,{className:"border-border/50",children:[e.jsxs(y,{className:"pb-3",children:[e.jsx(b,{className:"text-base flex items-center gap-2",children:r?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"h-4 w-4 text-primary"})," Code reçu par email"]}):s?e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"h-4 w-4 text-amber-500"})," Code de secours"]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"h-4 w-4 text-primary"})," Code d'authentification"]})}),e.jsx(C,{className:"text-xs",children:r?"Saisissez le code à 6 chiffres envoyé à votre adresse email. Pensez à vérifier vos spams.":s?"Saisissez l'un de vos codes de secours (format XXXXX-XXXXX).":"Ouvrez votre application d'authentification (Google Authenticator, Authy…) et saisissez le code à 6 chiffres."})]}),e.jsx(X,{children:e.jsxs("form",{onSubmit:A,className:"space-y-4",children:[j&&e.jsx(I,{variant:"destructive",children:e.jsxs(K,{className:"space-y-2",children:[e.jsx("p",{children:j}),e.jsx("p",{className:"text-xs opacity-80",children:r?"Vérifiez le code reçu par email (pensez aux spams) ou demandez un nouveau code ci-dessous.":s?"Vérifiez le format XXXXX-XXXXX (10 caractères + tiret). Chaque code n'est utilisable qu'une seule fois.":"Le code TOTP change toutes les 30 secondes. Attendez le code suivant ou utilisez un code de secours ci-dessous."})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"code",children:s?"Code de secours":"Code à 6 chiffres"}),e.jsxs("div",{className:"relative",children:[e.jsx(U,{id:"code",type:i?"text":"password",value:a,onChange:t=>F(t.target.value),placeholder:s?"XXXXX-XXXXX":"000000",className:`pr-10 text-center tracking-widest font-mono text-lg ${s?"tracking-normal text-sm":""}`,autoFocus:!0,autoComplete:"one-time-code",inputMode:s?"text":"numeric",disabled:c.isPending}),e.jsx("button",{type:"button",onClick:()=>k(!i),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground","aria-label":i?"Masquer le code":"Afficher le code","aria-pressed":i,children:i?e.jsx(D,{className:"h-4 w-4"}):e.jsx(q,{className:"h-4 w-4"})})]})]}),e.jsx(w,{type:"submit",className:"w-full",disabled:c.isPending||!s&&a.length!==6||s&&a.length<11,children:c.isPending?e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"h-4 w-4 mr-2 animate-spin"})," Vérification…"]}):"Vérifier"})]})})]}),e.jsxs("div",{className:"text-center space-y-2",children:[r?e.jsx("button",{type:"button",onClick:()=>{n(""),o(null),m.mutate({pendingToken:u})},disabled:m.isPending,className:"text-sm text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors disabled:opacity-50",children:m.isPending?"Envoi…":"Je n'ai pas reçu le code — renvoyer"}):e.jsx("button",{type:"button",onClick:()=>{z(!s),n(""),o(null)},className:"text-sm text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",children:s?"Utiliser mon application d'authentification":"Utiliser un code de secours"}),e.jsx("div",{children:e.jsxs("button",{type:"button",onClick:()=>p("/login"),className:"text-sm text-muted-foreground hover:text-foreground flex items-center gap-1 mx-auto",children:[e.jsx(S,{className:"h-3 w-3"}),"Retour à la connexion"]})})]})]})})}export{ae 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.