PageSourceSearch

https://help.portalidea.com.br/assets/ResetPassword-aT6Vijpw.js

js portalidea.com.br collected 2026-10-01 15:42:10 UTC 9,127 bytes, 6 lines download raw bytes

1import{f as z,U as B,r,u as U,s as y,j as e,S as d,C as x,a as f,b as p,c as g,d as j,B as n,I as k,t as l}from"./index-DYFI-0-M.js";import{L as S}from"./label-Cmaf3gPF.js";import{A as C}from"./arrow-left-XDy-mGUc.js";import{C as H}from"./circle-check-big-B8gvoZOa.js";import{L as v}from"./lock-DZ_udZZ_.js";import{a as P,E}from"./eye-CwUhzvNI.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const M=z("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),Y=()=>{const[L]=B(),[a,I]=r.useState(""),[i,A]=r.useState(""),[m,R]=r.useState(!1),[u,F]=r.useState(!1),[N,h]=r.useState(!1),[b,w]=r.useState(null),[D,O]=r.useState(!1),o=U(),c=L.get("token");r.useEffect(()=>{if(!c){o("/login");return}T()},[c,o]);const T=async()=>{try{const{data:s,error:t}=await y.functions.invoke("admin-reset-password",{body:{action:"validate",token:c}});w(!t&&(s==null?void 0:s.valid)===!0)}catch(s){console.error("Erro ao validar token:",s),w(!1)}},V=async s=>{if(s.preventDefault(),!a||!i){l({title:"Campos obrigatórios",description:"Por favor, preencha todos os campos.",variant:"destructive"});return}if(a.length<8){l({title:"Senha muito curta",description:"A senha deve ter pelo menos 8 caracteres.",variant:"destructive"});return}if(a!==i){l({title:"Senhas não coincidem",description:"As senhas digitadas não são iguais.",variant:"destructive"});return}h(!0);try{const{data:t,error:q}=await y.functions.invoke("admin-reset-password",{body:{action:"reset",token:c,password:a}});if(q||!(t!=null&&t.ok)){l({title:"Token inválido",description:"O token de reset é inválido ou expirou. Solicite um novo.",variant:"destructive"}),h(!1);return}O(!0),l({title:"Senha redefinida!",description:"Sua senha foi alterada com sucesso."})}catch(t){console.error("Erro ao redefinir senha:",t),l({title:"Erro interno",description:"Ocorreu um erro ao redefinir a senha. Tente novamente.",variant:"destructive"})}h(!1)};return b===!1?e.jsxs(e.Fragment,{children:[e.jsx(d,{title:"Token Inválido - Recuperação de Senha",description:"O token de recuperação de senha é inválido ou expirou."}),e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",style:{backgroundImage:"linear-gradient(135deg, hsl(180 65% 55% / 0.1) 0%, hsl(260 60% 55% / 0.1) 100%)"},children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs(x,{className:"shadow-elegant bg-gradient-card",children:[e.jsxs(f,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 w-16 h-16 bg-red-100 rounded-full flex items-center justify-center",children:e.jsx(M,{className:"h-8 w-8 text-red-600"})}),e.jsx(p,{className:"text-2xl font-bold",children:"Token Inválido"}),e.jsx(g,{children:"O link de recuperação é inválido ou expirou"})]}),e.jsx(j,{className:"space-y-4",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("p",{className:"text-muted-foreground",children:"O link que você utilizou pode ter expirado ou já foi usado. Links de recuperação são válidos por apenas 1 hora."}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[e.jsx("h4",{className:"font-semibold mb-2",children:"💡 O que fazer:"}),e.jsxs("ul",{className:"text-left space-y-1 text-muted-foreground",children:[e.jsx("li",{children:"• Solicite um novo link de recuperação"}),e.jsx("li",{children:"• Verifique se o link está completo"}),e.jsx("li",{children:"• Use o link mais recente recebido"})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs(n,{variant:"outline",onClick:()=>o("/login"),className:"flex-1",children:[e.jsx(C,{className:"h-4 w-4 mr-2"}),"Voltar ao Login"]}),e.jsx(n,{onClick:()=>o("/forgot-password"),className:"flex-1",children:"Solicitar Novo Link"})]})]})})]})})})]}):D?e.jsxs(e.Fragment,{children:[e.jsx(d,{title:"Senha Redefinida - Portal IDEA",description:"Sua senha foi redefinida com sucesso. Faça login com sua nova senha."}),e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",style:{backgroundImage:"linear-gradient(135deg, hsl(180 65% 55% / 0.1) 0%, hsl(260 60% 55% / 0.1) 100%)"},children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs(x,{className:"shadow-elegant bg-gradient-card",children:[e.jsxs(f,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:e.jsx(H,{className:"h-8 w-8 text-green-600"})}),e.jsx(p,{className:"text-2xl font-bold",children:"Senha Redefinida!"}),e.jsx(g,{children:"Sua senha foi alterada com sucesso"})]}),e.jsx(j,{className:"space-y-4",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("p",{className:"text-muted-foreground",children:"Sua senha foi redefinida com sucesso. Agora você pode fazer login com sua nova senha."}),e.jsxs("div",{className:"bg-green-50 rounded-lg p-4 text-sm",children:[e.jsx("h4",{className:"font-semibold mb-2 text-green-800",children:"🔒 Dicas de segurança:"}),e.jsxs("ul",{className:"text-left space-y-1 text-green-700",children:[e.jsx("li",{children:"• Use uma senha forte e única"}),e.jsx("li",{children:"• Não compartilhe sua senha"}),e.jsx("li",{children:"• Faça logout ao usar computadores públicos"})]})]}),e.jsx(n,{onClick:()=>
6o("/login"),className:"w-full bg-primary hover:bg-primary/90",children:"Fazer Login"})]})})]})})})]}):b===null?e.jsxs(e.Fragment,{children:[e.jsx(d,{title:"Validando Token - Recuperação de Senha",description:"Validando token de recuperação de senha..."}),e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Validando token de recuperação..."})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx(d,{title:"Redefinir Senha - Portal IDEA",description:"Crie uma nova senha para sua conta do Portal IDEA.",keywords:"redefinir senha, nova senha, portal idea, reset password"}),e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",style:{backgroundImage:"linear-gradient(135deg, hsl(180 65% 55% / 0.1) 0%, hsl(260 60% 55% / 0.1) 100%)"},children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs(x,{className:"shadow-elegant bg-gradient-card",children:[e.jsxs(f,{className:"text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[e.jsx("img",{src:"/icone.png",alt:"Portal IDEA Logo",className:"h-12 w-auto"}),e.jsx("div",{className:"w-12 h-12 bg-primary rounded-full flex items-center justify-center",children:e.jsx(v,{className:"h-6 w-6 text-primary-foreground"})})]}),e.jsx(p,{className:"text-2xl font-bold",children:"Nova Senha"}),e.jsx(g,{children:"Crie uma nova senha para sua conta."})]}),e.jsxs(j,{children:[e.jsxs("form",{onSubmit:V,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{htmlFor:"password",children:"Nova Senha"}),e.jsxs("div",{className:"relative",children:[e.jsx(v,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),e.jsx(k,{id:"password",type:m?"text":"password",placeholder:"Mínimo 6 caracteres",value:a,onChange:s=>I(s.target.value),className:"pl-10 pr-10 input-mobile",required:!0}),e.jsx(n,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>R(!m),children:m?e.jsx(P,{className:"h-4 w-4"}):e.jsx(E,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{htmlFor:"confirmPassword",children:"Confirmar Nova Senha"}),e.jsxs("div",{className:"relative",children:[e.jsx(v,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),e.jsx(k,{id:"confirmPassword",type:u?"text":"password",placeholder:"Digite a senha novamente",value:i,onChange:s=>A(s.target.value),className:"pl-10 pr-10 input-mobile",required:!0}),e.jsx(n,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>F(!u),children:u?e.jsx(P,{className:"h-4 w-4"}):e.jsx(E,{className:"h-4 w-4"})})]})]}),a&&i&&a!==i&&e.jsx("div",{className:"text-sm text-red-600",children:"As senhas não coincidem"}),e.jsx(n,{type:"submit",className:"w-full bg-primary hover:bg-primary/90 transition-smooth btn-mobile",disabled:N||a!==i,children:N?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Redefinindo..."]}):"Redefinir Senha"})]}),e.jsx("div",{className:"mt-6 text-center",children:e.jsxs(n,{variant:"ghost",onClick:()=>o("/login"),className:"text-muted-foreground hover:text-foreground",children:[e.jsx(C,{className:"h-4 w-4 mr-2"}),"Voltar ao Login"]})})]})]})})})]})};export{Y 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.