PageSourceSearch

https://floraflor.vercel.app/assets/ResetPasswordWithCode-CUNXCBFY.js

js floraflor.vercel.app collected 2026-10-03 06:57:13 UTC 4,397 bytes, 6 lines download raw bytes

1import{c as E,g as P,r as o,j as e,C as S,d as k,e as L,f as R,a as z,B as x,J as i,s as F}from"./index-Bqg1Zbbr.js";import{I as d}from"./input-BoM3ftyn.js";import{L as m}from"./label-DgCEAFHv.js";import{P as I,v as D}from"./passwordValidation-BvWPhTZF.js";import{E as M}from"./eye-off-DTcpvmg5.js";import{E as V}from"./eye-DhAs1zGr.js";import{L as A}from"./loader-circle-iIcN26CM.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 T=E("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),U=()=>{const p=P(),[n,g]=o.useState(""),[u,j]=o.useState(""),[l,C]=o.useState(""),[h,v]=o.useState(""),[c,y]=o.useState(!1),[a,f]=o.useState(!1),b=async s=>{if(s.preventDefault(),!u||!n||!l||!h){i.error("Por favor completa todos los campos");return}if(n.length!==6){i.error("El código debe tener 6 dígitos");return}const t=D(l);if(!t.valid){i.error(t.message);return}if(l!==h){i.error("Las contraseñas no coinciden");return}f(!0);try{const{data:r,error:w}=await F.functions.invoke("reset-password-with-code",{body:{email:u.trim().toLowerCase(),code:n.trim(),newPassword:l}});if(w)throw w;if(r!=null&&r.error)throw new Error(r.error);i.success("¡Contraseña actualizada exitosamente!"),setTimeout(()=>p("/acceso"),1500)}catch(r){console.error("Reset password error:",r),i.error(r.message||"Error al resetear la contraseña")}finally{f(!1)}},N=s=>{const t=s.target.value.replace(/\D/g,"").slice(0,6);g(t)};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4",children:e.jsxs(S,{className:"w-full max-w-md border-border/50 shadow-xl",children:[e.jsxs(k,{className:"space-y-3 text-center",children:[e.jsx("div",{className:"mx-auto w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center",children:e.jsx(T,{className:"h-6 w-6 text-primary"})}),e.jsx(L,{className:"text-2xl",children:"Resetear Contraseña"}),e.jsx(R,{children:"Ingresa el código de 6 dígitos que recibiste por email"})]}),e.jsx(z,{children:e.jsxs("form",{onSubmit:b,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"email",children:"Email"}),e.jsx(d,{id:"email",type:"email",placeholder:"[email protected]",value:u,onChange:s=>j(s.target.value),disabled:a,autoComplete:"email"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"code",children:"Código de Verificación"}),e.jsx(d,{id:"code",type:"text",inputMode:"numeric",placeholder:"123456",value:n,onChange:N,disabled:a,className:"text-center text-2xl tracking-widest font-mono",maxLength:6,autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"El código expira en 10 minutos"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"newPassword",children:"Nueva Contraseña"}),e.jsxs("div",{className:"relative",children:[e.jsx(d,{id:"newPassword",type:c?"text":"password",placeholder:"Mínimo 8 caracteres",value:l,onChange:s=>C(s.target.value),disabled:a,autoComplete:"new-password"}),e.jsx(x,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>y(!c),disabled:a,children:c?e.jsx(M,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(V,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsx("ul",{className:"text-xs text-muted-foreground space-y-0.5",children:I.map((s,t)=>e.jsxs("li",{children:["• ",s]},t))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"confirmPassword",children:"Confirmar Contraseña"}),e.jsx(d,{id:"confirmPassword",type:c?"text":"password",placeholder:"Repite la contraseña",value:h,onChange:s=>v(s.target.value),disabled:a,autoComplete:"new-password"})]}),e.jsx(x,{type:"submit",className:"w-full",disabled:a,children:a?e.jsxs(e.Fragment,{children:[e.jsx(A,{className:"mr-2 h-4 w-4 animate-spin"}),"Actualizando..."]}):"Actualizar Contraseña"}),e.jsx(x,{type:"button",variant:"ghost",className:"w-full",onClick:()=>p("/acceso"),disabled:a,children:"Volver al inicio de sesión"})]})})]})})};export{U 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.