PageSourceSearch

https://www.bindstack.ai/assets/OtpVerificationPage-nby43Eu_.js

js bindstack.ai collected 2026-10-05 15:02:10 UTC 3,788 bytes, 1 lines download raw bytes

1import{r as h,j as e}from"./ui-vendor-Da9uQuMW.js";import{B as j}from"./separator-CcGBAGgT.js";import{u as b,C as S}from"./index.esm-CPxzRGRC.js";import{a as w}from"./zod-CYT7bu3-.js";import{S as v,t as f,cu as N,l as O,a as y,cw as F,cx as V,p as A,ag as C}from"./App-B1QN_3sS.js";import{f as E,a as R,c as g,d as k}from"./field-fegNnuR1.js";import{u as P}from"./use-location-state-DCb-o99A.js";import{c as I,u as B}from"./utils-DxXc-Znk.js";import{v as T}from"./types-DnTBNnSb.js";import{A as _}from"./auth-otp-input-BP33Aym1.js";import{A as D}from"./auth-title-G6OqXxxN.js";import"./charts-vendor-DWyOgyj2.js";import"./schemas-Co01wv4L.js";import"./index-CmeDnPm-.js";import"./icons-dynamic-vendor-Cqq8S-fy.js";import"./triangle-alert-DXdl2qp5.js";import"./label-CRXglOZ-.js";import"./input-otp-CPyV8PBf.js";import"./minus-C0Flo8Mh.js";function L({email:i}){const[s,n]=h.useState(90),[o,c]=h.useState(!0),[l,d]=h.useState(!1);h.useEffect(()=>{if(!o)return;const r=setInterval(()=>{n(t=>t<=1?(c(!1),0):t-1)},1e3);return()=>clearInterval(r)},[o]);const x=async()=>{if(!i){f.error("Email not found. Please start from login page.");return}try{d(!0),await N(i),n(90),c(!0),f.success("Verification code has been resent.")}catch(r){O.error("Failed to resend OTP",r),f.error("Failed to resend verification code. Please try again.")}finally{d(!1)}},u=s>0||l,m=r=>{const t=Math.floor(r/60),p=(r%60).toString().padStart(2,"0");return`${t}:${p}`};return e.jsxs(E,{className:"px-6 text-center",children:[s>0?"Resend again in":"Didn't receive the code?"," ",e.jsx("span",{onClick:u?void 0:x,className:`inline-flex items-center gap-1 underline ${u?"text-gray-400 cursor-not-allowed":"cursor-pointer hover:text-black"}`,children:l?e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"h-3 w-3"})," Resending..."]}):s>0?m(s):"Resend Code"})]})}function M({className:i,...s}){const n=y(),o=P(),c=o?.email,l=o?.isOAuthFlow??!1,d=o?.from,{control:x,handleSubmit:u,formState:{isSubmitting:m}}=b({resolver:w(T),mode:"onChange",defaultValues:{code:""}}),r=async t=>{if(!c){f.error("Email not found. Please start from login page."),n("/auth");return}try{const a=await F(c,t.code),p=await V(a.data.mfa_challenge);p.data.user_mfa_registered?n("/auth/2fa",{state:{mfa_token:a.data.mfa_challenge,isOAuthFlow:l,from:d}}):n("/auth/2fa/setup",{state:{...p.data,isOAuthFlow:l,from:d}})}catch(a){f.error(A(a,"Invalid verification code. Please try again."))}};return e.jsxs("div",{className:I("flex flex-col gap-8",i),...s,children:[e.jsx("form",{onSubmit:u(r),children:e.jsxs(R,{className:"gap-8",children:[e.jsx(D,{title:"Email Verification",description:"We've sent a one-time verification code to your email address. Enter the code below to sign in."}),e.jsx("span",{className:"font-semibold text-center",children:"Verification Code"}),e.jsx(g,{className:"flex justify-center",children:e.jsx(S,{name:"code",control:x,rules:{required:"Verification code is required",minLength:{value:6,message:"Verification code must be 6 digits"}},render:({field:t,fieldState:a})=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{value:t.value,onChange:t.onChange}),a.error&&e.jsx(k,{className:"text-center",children:a.error.message})]})})}),e.jsx(g,{children:e.jsx(j,{type:"submit",disabled:m,"aria-busy":m,children:m?e.jsxs(e.Fragment,{children:[e.jsx(v,{}),"Verifying..."]}):"Verify & Continue"})})]})}),e.jsx(L,{email:c})]})}function ne(){B("Otp Verification");const i=y(),s=()=>{i(-1)};return e.jsxs("div",{className:"w-full h-full items-center bg-background flex flex-col justify-center gap-6",children:[e.jsx(j,{variant:"outline",size:"icon","aria-label":"Back",className:"mb-2 shadow-none self-start",onClick:s,children:e.jsx(C,{})}),e.jsx("div",{className:"w-full max-w-sm",children:e.jsx(M,{})})]})}export{ne 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.