PageSourceSearch

https://orcamente.com/assets/ResetPassword-YcxXZVkE.js

js orcamente.com collected 2026-10-05 11:32:39 UTC 6,870 bytes, 1 lines download raw bytes

1import{r as a,j as e}from"./vendor-react-CWYumzBr.js";import{b as B,a as O,L as N}from"./vendor-router-DDVMqb5T.js";import{l as T}from"./logo-oficial-Bi8T_NOX.js";import{B as w,s as U,g as V}from"./index-CgFehujB.js";import{I as g}from"./input-BQyK8uko.js";import{L as y}from"./label-D2L_MZFy.js";import{a3 as $,l as x,bb as z,ak as F,L as S,b8 as k,aA as C}from"./vendor-icons-CCGX0ylw.js";import"./vendor-ui-utils-B2rm_Apj.js";import"./vendor-query-CsGMBXWd.js";import"./vendor-supabase-CpEjk3jd.js";const P=[{label:"Pelo menos 8 caracteres",test:t=>t.length>=8},{label:"Uma letra maiúscula",test:t=>/[A-Z]/.test(t)},{label:"Uma letra minúscula",test:t=>/[a-z]/.test(t)},{label:"Um número",test:t=>/[0-9]/.test(t)}],W=()=>{const[t]=B(),u=O(),h=t.get("token"),[r,d]=a.useState("loading"),[i,L]=a.useState(""),[n,E]=a.useState(""),[f,A]=a.useState(!1),[p,R]=a.useState(!1),[b,j]=a.useState(!1);a.useEffect(()=>{if(!h){d("invalid");return}d("form")},[h]),a.useEffect(()=>{if(r==="success"){const s=setTimeout(()=>u("/auth"),3e3);return()=>clearTimeout(s)}},[r,u]);const v=P.every(s=>s.test(i)),m=i===n&&n.length>0,q=async s=>{var o;if(s.preventDefault(),!(!v||!m)){j(!0);try{const{data:l,error:c}=await U.functions.invoke("reset-password",{body:{token:h,newPassword:i}});if(c)throw c;d("success")}catch(l){const c=(l==null?void 0:l.message)||"";c.includes("inválido")||c.includes("expirado")||((o=l==null?void 0:l.context)==null?void 0:o.status)===400?d("invalid"):V.error("Erro ao redefinir senha. Tente novamente.")}finally{j(!1)}}};return e.jsxs("div",{className:"min-h-screen bg-[hsl(192,60%,8%)] flex items-center justify-center p-4",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute top-20 right-10 w-[400px] h-[400px] bg-[hsl(160,84%,50%)]/5 rounded-full blur-[100px]"}),e.jsx("div",{className:"absolute bottom-20 left-10 w-[300px] h-[300px] bg-[hsl(192,70%,30%)]/10 rounded-full blur-[100px]"})]}),e.jsxs("div",{className:"w-full max-w-md relative z-10",children:[e.jsxs(N,{to:"/auth",className:"inline-flex items-center gap-2 text-slate-400 hover:text-[hsl(160,84%,50%)] transition-colors mb-8",children:[e.jsx($,{className:"w-4 h-4"}),"Voltar para o login"]}),e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:T,alt:"Orçamente",className:"h-12 object-contain"})}),e.jsx("h1",{className:"text-xl font-semibold text-white mb-1",children:"Nova Senha"})]}),e.jsxs("div",{className:"bg-[hsl(192,50%,10%)] rounded-2xl p-8 border border-slate-700/50",children:[r==="loading"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx(x,{className:"w-8 h-8 text-[hsl(160,84%,50%)] animate-spin"}),e.jsx("p",{className:"text-slate-400 text-sm",children:"Validando link..."})]}),r==="invalid"&&e.jsxs("div",{className:"text-center space-y-5",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-16 h-16 rounded-full bg-red-500/10 border border-red-500/20 flex items-center justify-center",children:e.jsx(z,{className:"w-8 h-8 text-red-400"})})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium mb-1",children:"Link inválido ou expirado"}),e.jsx("p",{className:"text-sm text-slate-400",children:"Este link de redefinição não é mais válido. Solicite um novo link."})]}),e.jsx(N,{to:"/esqueci-senha",children:e.jsx(w,{className:"w-full bg-[hsl(160,84%,50%)] hover:bg-[hsl(160,84%,45%)] text-[hsl(192,60%,8%)] font-semibold",children:"Solicitar novo link"})})]}),r==="success"&&e.jsxs("div",{className:"text-center space-y-5",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-16 h-16 rounded-full bg-[hsl(160,84%,50%)]/10 border border-[hsl(160,84%,50%)]/20 flex items-center justify-center",children:e.jsx(F,{className:"w-8 h-8 text-[hsl(160,84%,50%)]"})})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium mb-1",children:"Senha redefinida com sucesso!"}),e.jsx("p",{className:"text-sm text-slate-400",children:"Você será redirecionado para o login em instantes..."})]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(x,{className:"w-5 h-5 text-[hsl(160,84%,50%)] animate-spin"})})]}),r==="form"&&e.jsxs("form",{onSubmit:q,className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"password",className:"text-slate-300 text-sm",children:"Nova senha"}),e.jsxs("div",{className:"relative",children:[e.jsx(S,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(g,{id:"password",type:f?"text":"password",value:i,onChange:s=>L(s.target.value),placeholder:"••••••••",required:!0,className:"pl-10 pr-10 bg-[hsl(192,55%,6%)] border-slate-700 text-white placeholder:text-slate-500 focus-visible:ring-[hsl(160,84%,50%)] focus-visible:border-[hsl(160,84%,50%)]"}),e.jsx("button",{type:"button",onClick:()=>A(s=>!s),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-300",children:f?e.jsx(k,{className:"w-4 h-4"}):e.jsx(C,{className:"w-4 h-4"})})]})]}),i.length>0&&e.jsx("div",{className:"bg-[hsl(192,55%,6%)] rounded-xl p-3 space-y-1.5",children:P.map(s=>{const o=s.test(i);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 transition-colors ${o?"bg-[hsl(160,84%,50%)]":"bg-slate-600"}`}),e.jsx("span",{className:`text-xs transition-colors ${o?"text-[hsl(160,84%,50%)]":"text-slate-500"}`,children:s.label})]},s.label)})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"confirm",className:"text-slate-300 text-sm",children:"Confirmar nova senha"}),e.jsxs("div",{className:"relative",children:[e.jsx(S,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(g,{id:"confirm",type:p?"text":"password",value:n,onChange:s=>E(s.target.value),placeholder:"••••••••",required:!0,className:`pl-10 pr-10 bg-[hsl(192,55%,6%)] border-slate-700 text-white placeholder:text-slate-500 focus-visible:ring-[hsl(160,84%,50%)] focus-visible:border-[hsl(160,84%,50%)] ${n.length>0&&!m?"border-red-500/50":""}`}),e.jsx("button",{type:"button",onClick:()=>R(s=>!s),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-300",children:p?e.jsx(k,{className:"w-4 h-4"}):e.jsx(C,{className:"w-4 h-4"})})]}),n.length>0&&!m&&e.jsx("p",{className:"text-xs text-red-400",children:"As senhas não coincidem"})]}),e.jsx(w,{type:"submit",disabled:b||!v||!m,className:"w-full bg-[hsl(160,84%,50%)] hover:bg-[hsl(160,84%,45%)] text-[hsl(192,60%,8%)] font-semibold h-11 disabled:opacity-50",children:b?e.jsx(x,{className:"w-4 h-4 animate-spin"}):"Salvar nova senha"})]})]})]})]})};export{W 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.