PageSourceSearch

https://fletes.dlx.ai/assets/definir-password-Ba06RmGs.js

js dlx.ai collected 2026-10-05 15:32:37 UTC 3,470 bytes, 1 lines download raw bytes

1import{i as B,u as D,r as a,s as d,j as e}from"./index-B2COkObf.js";import{g as E,C as F,a as M,D as T,h as A,i as I}from"./card-DAKu38gs.js";import{P as p}from"./password-input-BpRU36Kd.js";import{L as u}from"./label-FnTEP7Qq.js";import{B as R}from"./input-y9n6oDoh.js";import{L as H}from"./lock-C8xbenaR.js";const U={url:"/brand/header-logo.webp"};function V(){const g=B(),{t:s,path:j}=D(),[n,w]=a.useState(""),[m,y]=a.useState(""),[i,N]=a.useState(""),[x,r]=a.useState(""),[S,C]=a.useState(!1),[h,f]=a.useState(!1),[P,b]=a.useState(null),[v,L]=a.useState(!1);a.useEffect(()=>{let t=!0;(async()=>{const{data:l}=await d.auth.getSession();if(t&&(b(!!l.session),l.session)){const c=await E().catch(()=>null);t&&L(!!c?.debeCambiarPassword)}})();const{data:o}=d.auth.onAuthStateChange((l,c)=>{b(!!c)});return()=>{t=!1,o.subscription.unsubscribe()}},[]);const k=async t=>{if(t.preventDefault(),r(""),n.length<8){r(s("p.errMin"));return}if(n!==m){r(s("p.errMismatch"));return}f(!0);try{if(v){if(!i){r(s("p.errTemporal"));return}const o=await A({data:{actual:i,nueva:n}}).catch(()=>({ok:!1,error:s("p.errSave")}));if(!o.ok){r(o.error);return}}else{const{error:o}=await d.auth.updateUser({password:n});if(o){r(s("p.errInvite"));return}await I().catch(()=>{})}C(!0),setTimeout(()=>g({to:j("/dashboard"),replace:!0}),900)}finally{f(!1)}};return e.jsxs("div",{className:"flex min-h-screen w-full flex-col bg-background text-foreground",children:[e.jsx("main",{className:"flex flex-1 items-center justify-center px-4 py-16",children:e.jsx(F,{className:"w-full max-w-md border-border bg-card",children:e.jsxs(M,{className:"p-6 sm:p-8",children:[e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("img",{src:U.url,alt:"DeltaX AI",width:456,height:107,className:"aspect-[4.26] w-[150px] object-contain"}),e.jsx("h1",{className:"mt-6 font-display text-2xl font-bold tracking-tight",children:s("p.title")}),e.jsxs("p",{className:"mt-2 inline-flex items-center gap-2 font-sans text-xs text-muted-foreground",children:[e.jsx(H,{className:"h-3.5 w-3.5 text-primary"}),s("p.sub")]})]}),P===!1?e.jsx("p",{className:"mt-8 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 font-sans text-sm text-destructive",children:s("p.expired")}):S?e.jsx("p",{className:"mt-8 rounded-md border border-primary/40 bg-primary/10 px-3 py-2 font-sans text-sm text-primary",children:s("p.saved")}):e.jsxs("form",{className:"mt-8 space-y-4",onSubmit:t=>{k(t)},noValidate:!0,children:[v&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(u,{htmlFor:"pass-actual",children:s("p.temporal")}),e.jsx(p,{id:"pass-actual",autoComplete:"current-password",value:i,onChange:t=>N(t.target.value),placeholder:s("p.temporalPh")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(u,{htmlFor:"pass",children:s("p.new")}),e.jsx(p,{id:"pass",autoComplete:"new-password",value:n,onChange:t=>w(t.target.value),placeholder:s("p.newPh")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(u,{htmlFor:"pass2",children:s("p.repeat")}),e.jsx(p,{id:"pass2",autoComplete:"new-password",value:m,onChange:t=>y(t.target.value),placeholder:"••••••••"})]}),x&&e.jsx("p",{role:"alert",className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 font-sans text-sm text-destructive",children:x}),e.jsx(R,{type:"submit",className:"w-full",disabled:h,children:s(h?"p.saving":"p.save")})]})]})})}),e.jsx(T,{})]})}const K=V;export{K as component};

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.