1import{c as w,r as s,u as v,j as e,e as y,L as k,b as C}from"./index-Dsd8GAzx.js";import{B as h}from"./button-BvA20N-A.js";import{I as p}from"./input-DtZaQ6y1.js";import{C as P}from"./circle-x-B95yijeT.js";/** 2 * @license lucide-react v0.475.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const I=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],L=w("CircleCheckBig",I);function B(){const[l,f]=s.useState(null),[r,g]=s.useState(""),[c,b]=s.useState(""),[m,d]=s.useState(!1),[x,i]=s.useState("idle"),[o,a]=s.useState(""),N=v();s.useEffect(()=>{const n=new URLSearchParams(window.location.search).get("token");if(!n){i("error"),a("Aucun token trouvé dans l'URL.");return}f(n)},[]);const j=async()=>{var n,u;if(!/^\d{4}$/.test(r)){a("Le PIN doit contenir exactement 4 chiffres");return}if(r!==c){a("Les deux PIN ne correspondent pas");return}a(""),d(!0);const t=await C.functions.invoke("resetPinWithToken",{token:l,newPin:r});(n=t.data)!=null&&n.success?i("success"):(i("error"),a(((u=t.data)==null?void 0:u.error)||"Erreur lors de la modification")),d(!1)};return e.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center px-4",children:e.jsxs("div",{className:"bg-[#111] border border-white/10 rounded-2xl p-10 max-w-md w-full text-center shadow-2xl",children:[e.jsx("img",{src:"https://media.base44.com/images/public/69d3bbd071c32e8e2cd61c44/ba76294fa_CodirLogo.png",alt:"CODIR",className:"h-12 mx-auto mb-6"}),x==="success"?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-12 w-12 text-green-400 mx-auto mb-4"}),e.jsx("h2",{className:"font-space font-bold text-2xl text-white mb-2",children:"PIN modifié !"}),e.jsx("p",{className:"text-white/50 text-sm mb-6",children:"Votre nouveau code PIN est actif."}),e.jsx(h,{onClick:()=>N("/app/profile"),className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:"Retour au profil"})]}):x==="error"&&!l?e.jsxs(e.Fragment,{children:[e.jsx(P,{className:"h-12 w-12 text-red-400 mx-auto mb-4"}),e.jsx("h2",{className:"font-space font-bold text-2xl text-white mb-2",children:"Lien invalide"}),e.jsx("p",{className:"text-white/50 text-sm",children:o})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-12 w-12 rounded-2xl bg-primary/10 flex items-center justify-center mx-auto mb-4",children:e.jsx(y,{className:"h-5 w-5 text-primary"})}),e.jsx("h2",{className:"font-space font-bold text-2xl text-white mb-2",children:"Nouveau code PIN"}),e.jsx("p",{className:"text-white/50 text-sm mb-6",children:"Choisissez un PIN à 4 chiffres pour révéler votre clé de licence."}),e.jsxs("div",{className:"space-y-3 mb-4",children:[e.jsx(p,{type:"password",inputMode:"numeric",maxLength:4,placeholder:"Nouveau PIN",value:r,onChange:t=>g(t.target.value.replace(/\D/g,"").slice(0,4)),className:"bg-secondary border-border/50 tracking-[0.5em] text-center text-lg"}),e.jsx(p,{type:"password",inputMode:"numeric",maxLength:4,placeholder:"Confirmer le PIN",value:c,onChange:t=>b(t.target.value.replace(/\D/g,"").slice(0,4)),className:"bg-secondary border-border/50 tracking-[0.5em] text-center text-lg"})]}),o&&e.jsx("p",{className:"text-red-400 text-xs mb-4",children:o}),e.jsx(h,{onClick:j,disabled:m||r.length!==4||c.length!==4,className:"w-full bg-primary hover:bg-primary/90 text-primary-foreground",children:m?e.jsx(k,{className:"h-4 w-4 animate-spin"}):"Définir le nouveau PIN"})]})]})})}export{B 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.