PageSourceSearch

https://www.abotts.com.br/assets/AdminSetPassword-BAEu13nQ.js

js abotts.com.br collected 2026-10-05 18:42:18 UTC 3,705 bytes, 1 lines download raw bytes

1import{j as e}from"./query-vendor-C1qhYsCj.js";import{u as j,c as v,a,L as y}from"./react-vendor-xDvJ4pJJ.js";import{A as w}from"./admin-content-X0nda10a.js";import{ag as N,at as S,au as C}from"./ui-vendor-DS15vDUt.js";function L(){const[m]=j(),u=v(),s=m.get("token"),[o,f]=a.useState(""),[i,p]=a.useState(""),[d,r]=a.useState(""),[l,c]=a.useState(!1),[x,h]=a.useState(!1);a.useEffect(()=>{s||r("Convite inválido ou ausente")},[s]);const b=async t=>{if(t.preventDefault(),r(""),!s){r("Convite inválido ou ausente");return}if(o.length<8){r("A senha deve ter pelo menos 8 caracteres");return}if(o!==i){r("As senhas não coincidem");return}c(!0);try{const n=await fetch(`${w}/admin/accept-invite`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:s,password:o})}),g=await n.json();if(!n.ok)throw new Error(g.error||"Não foi possível definir a senha");h(!0),setTimeout(()=>u("/admin/login"),2500)}catch(n){r(n instanceof Error?n.message:"Erro ao definir senha")}finally{c(!1)}};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-background to-secondary px-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-xl p-8 border border-border",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-primary/10 rounded-full mb-4",children:e.jsx(N,{size:32,className:"text-primary"})}),e.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Definir senha CMS"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Crie sua senha para acessar o painel administrativo."})]}),x?e.jsxs("div",{className:"text-center space-y-5",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 bg-green-500/10 rounded-full",children:e.jsx(S,{size:28,className:"text-green-500"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Senha definida"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Redirecionando para o login do CMS..."})]}),e.jsx(y,{to:"/admin/login",className:"block w-full bg-primary hover:bg-primary/90 text-primary-foreground py-3 rounded-lg font-semibold transition",children:"Ir para login"})]}):e.jsxs("form",{onSubmit:b,className:"space-y-4",children:[d&&e.jsxs("div",{className:"p-3 bg-red-500/10 border border-red-500/20 rounded-lg text-red-500 text-sm flex gap-2",children:[e.jsx(C,{size:18,className:"flex-shrink-0 mt-0.5"}),e.jsx("span",{children:d})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium mb-2",children:"Nova senha"}),e.jsx("input",{type:"password",id:"password",value:o,onChange:t=>f(t.target.value),className:"w-full px-4 py-3 bg-background border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary",placeholder:"Mínimo 8 caracteres",required:!0,autoComplete:"new-password",disabled:!s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium mb-2",children:"Confirmar senha"}),e.jsx("input",{type:"password",id:"confirmPassword",value:i,onChange:t=>p(t.target.value),className:"w-full px-4 py-3 bg-background border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary",placeholder:"Digite novamente",required:!0,autoComplete:"new-password",disabled:!s})]}),e.jsx("button",{type:"submit",disabled:l||!s,className:"w-full bg-primary hover:bg-primary/90 text-primary-foreground py-3 rounded-lg font-semibold transition disabled:opacity-50",children:l?"Salvando...":"Definir senha"})]})]})})})}export{L 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.