PageSourceSearch

https://www.instagem.ai/assets/UpdatePassword-BlK4awbC.js

js instagem.ai collected 2026-10-05 12:04:38 UTC 4,591 bytes, 1 lines download raw bytes

1import{r as t,a as y,E as P,b as C,u as R,W as g,j as e,B as k,C as L,g as A,h as E,k as U,l as I,z as x,n as v,I as b,c as j}from"./main-DX7XzkoU.js";import{h as D}from"./instagem-hero-DMfFP84w.js";import{A as B}from"./arrow-left-Cf41rOjY.js";const z=()=>{const[c,u]=t.useState(!1),[i,h]=t.useState(""),[m,p]=t.useState(""),[N,f]=t.useState(!1),o=y(),{toast:d}=P(),{t:s}=C(),{session:l,isLoading:w}=R(),n=t.useRef(!1);t.useEffect(()=>{const{data:{subscription:r}}=g.auth.onAuthStateChange((a,S)=>{console.log("UpdatePassword - Auth event:",a),console.log("UpdatePassword - Session:",S?"exists":"none"),a==="PASSWORD_RECOVERY"?(console.log("UpdatePassword - PASSWORD_RECOVERY event detected"),n.current=!0,f(!0)):a==="SIGNED_IN"&&!n.current&&(console.log("UpdatePassword - User already signed in, redirecting to dashboard"),o("/dashboard"))});return()=>{r.unsubscribe()}},[o]),t.useEffect(()=>{w||(!l&&!n.current?(console.log("UpdatePassword - No session found, redirecting to login"),d({title:s("auth.errors.password_update_error"),description:"Sessão inválida. Solicite um novo link de redefinição.",variant:"destructive"}),o("/login")):l&&!n.current&&f(!0))},[l,w,o,d,s]);const _=async r=>{if(r.preventDefault(),i!==m){d({title:s("auth.errors.password_update_error"),description:s("auth.errors.passwords_dont_match"),variant:"destructive"});return}if(i.length<6){d({title:s("auth.errors.password_update_error"),description:s("auth.errors.weak_password"),variant:"destructive"});return}u(!0);try{const{error:a}=await g.auth.updateUser({password:i});if(a)throw a;d({title:s("auth.password_updated_title"),description:s("auth.password_updated_desc")}),h(""),p(""),setTimeout(()=>{o("/dashboard")},1e3)}catch(a){d({title:s("auth.errors.password_update_error"),description:a.message||s("errors.something_wrong"),variant:"destructive"})}finally{u(!1)}};return N?e.jsxs("div",{className:"min-h-screen bg-gradient-background flex",children:[e.jsxs("div",{className:"hidden lg:flex lg:w-1/2 relative overflow-hidden",children:[e.jsx("img",{src:D,alt:`${k.name} Interface`,className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-background/20 to-background/60"})]}),e.jsx("div",{className:"w-full lg:w-1/2 flex items-center justify-center p-8",children:e.jsxs("div",{className:"w-full max-w-md 
1space-y-3",children:[e.jsxs(L,{className:"bg-surface-card/50 backdrop-blur-sm border-border/50",children:[e.jsxs(A,{children:[e.jsx(E,{children:s("auth.update_password")}),e.jsx(U,{children:s("auth.update_password_desc")})]}),e.jsx(I,{className:"space-y-4",children:e.jsxs("form",{onSubmit:_,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"new-password",children:s("auth.new_password")}),e.jsxs("div",{className:"relative",children:[e.jsx(v,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(b,{id:"new-password",type:"password",placeholder:s("auth.new_password_placeholder"),value:i,onChange:r=>h(r.target.value),className:"pl-10 bg-surface-elevated border-border/50",required:!0,minLength:6})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"confirm-password",children:s("auth.confirm_password")}),e.jsxs("div",{className:"relative",children:[e.jsx(v,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(b,{id:"confirm-password",type:"password",placeholder:s("auth.confirm_password_placeholder"),value:m,onChange:r=>p(r.target.value),className:"pl-10 bg-surface-elevated border-border/50",required:!0,minLength:6})]})]}),e.jsx(j,{type:"submit",className:"w-full",variant:"default",size:"lg",disabled:c,children:s(c?"auth.updating_password":"auth.update_password_button")})]})})]}),e.jsx("div",{className:"text-center",children:e.jsxs(j,{variant:"ghost",size:"sm",onClick:()=>o("/login"),className:"mt-3",children:[e.jsx(B,{className:"w-4 h-4 mr-2"}),s("common.back")]})}),e.jsx("div",{className:"text-center mt-8 pt-6 border-t border-border/50",children:e.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsx("div",{className:"font-medium",children:"GMBN Software LTDA - 62.363.484/0001-90"}),e.jsx("div",{className:"mt-2",children:"Avenida Brigadeiro Faria Lima 1811 - Sala 1119, Jardim Paulistano, São Paulo - SP, 01452-001"})]})})]})})]}):e.jsx("div",{className:"min-h-screen bg-gradient-background flex items-center justify-center",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-muted-foreground",children:"Validando link de recuperação..."})})})};export{z 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.