1import{P as v,Q as g,O as n,L as e,T as y,U as N,a1 as C,W as b,X as S,Y as E,a2 as d,a3 as m,Z as L,a4 as F,a5 as t,a0 as h}from"./index_ec3ba43a.js";function D(){const{user:p,loading:x}=v(),c=g(),[r,f]=n.useState(""),[o,w]=n.useState(""),[i,l]=n.useState(!1);if(!x&&!p)return c("/auth",{replace:!0}),null;const j=async s=>{if(s.preventDefault(),r.length<8){t.error("A senha deve ter ao menos 8 caracteres");return}if(r!==o){t.error("As senhas não conferem");return}l(!0);try{const{error:a}=await h.auth.updateUser({password:r});if(a)throw a;const{error:u}=await h.rpc("clear_must_change_password");if(u)throw u;t.success("Senha atualizada com sucesso"),c("/",{replace:!0})}catch(a){t.error("Erro ao atualizar senha",{description:a instanceof Error?a.message:String(a)})}finally{l(!1)}};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-6",children:e.jsxs(y,{className:"w-full max-w-md shadow-xl",children:[e.jsxs(N,{children:[e.jsx("div",{className:"mx-auto mb-2 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(C,{className:"h-6 w-6 text-primary"})}),e.jsx(b,{className:"text-center",children:"Defina uma nova senha"}),e.jsx(S,{className:"text-center",children:"Sua senha foi resetada por um administrador. Escolha uma nova senha para continuar."})]}),e.jsx(E,{children:e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"pw",children:"Nova senha"}),e.jsx(m,{id:"pw",type:"password",value:r,onChange:s=>f(s.target.value),placeholder:"MÃnimo 8 caracteres",required:!0,minLength:8,autoFocus:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"pw2",children:"Confirmar nova senha"}),e.jsx(m,{id:"pw2",type:"password",value:o,onChange:s=>w(s.target.value),required:!0,minLength:8})]}),e.jsxs(L,{type:"submit",className:"w-full",disabled:i,children:[i&&e.jsx(F,{className:"h-4 w-4 animate-spin mr-2"}),"Salvar nova senha"]})]})})]})})}export{D 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.