PageSourceSearch

https://bituncoin.com/assets/EmailVerify-CgNrsQRu.js

js bituncoin.com collected 2026-10-09 22:56:11 UTC 3,779 bytes, 1 lines download raw bytes

1import{u as j,e as N,r as i,p as c,j as e,D as w}from"./index-EywfG2Uv.js";const S=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function E(){const u=j(),{toast:m}=N(),[p,f]=i.useState("request"),[s,g]=i.useState(c.authStore.record?.email||""),[h,y]=i.useState(""),[d,b]=i.useState(""),[o,n]=i.useState(!1),[l,a]=i.useState(""),x=async t=>{if(t?.preventDefault(),a(""),!S.test(s)){a("Please enter a valid email address.");return}n(!0);try{const r=await c.collection("users").requestOTP(s.trim().toLowerCase());y(r.otpId),f("code"),m({title:"Code sent",description:`A 6-digit verification code was emailed to ${s}.`})}catch(r){a(r?.message||"Could not send the verification email. Please try again.")}finally{n(!1)}},v=async t=>{if(t?.preventDefault(),a(""),!d.trim()){a("Enter the code from your email.");return}n(!0);try{await c.collection("users").authWithOTP(h,d.trim());try{await c.collection("users").requestVerification(s.trim().toLowerCase())}catch{}m({title:"Verified",description:"Your email is verified. Redirecting…"}),setTimeout(()=>u("/dashboard"),800)}catch(r){a(r?.message||"That code is incorrect or expired. Request a new one.")}finally{n(!1)}};return e.jsx("div",{className:"min-h-screen bg-background text-foreground grid place-items-center px-4",children:e.jsxs("div",{className:"w-full max-w-md glass rounded-2xl p-7 space-y-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(w,{size:"small",onClick:()=>u("/")}),e.jsxs("div",{children:[e.jsx("h1",{className:"font-display text-xl font-bold",children:"Email Verification"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Secure OTP code delivery"})]})]}),p==="request"?e.jsxs("form",{onSubmit:x,className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:"Email address"}),e.jsx("input",{type:"email",value:s,onChange:t=>g(t.target.value),placeholder:"[email protected]",autoComplete:"email",className:"w-full rounded-xl border border-input bg-secondary/50 px-3 py-2.5 text-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"})]}),l&&e.jsx("p",{className:"text-xs text-red-400",children:l}),e.jsx("button",{type:"submit",disabled:o,className:"w-full gold-gradient text-black font-semibold rounded-xl px-4 py-2.5 text-sm transition-transform active:scale-[0.98] hover:brightness-110 disabled:opacity-60",children:o?"Sending…":"Send verification code"})]}):e.jsxs("form",{onSubmit:v,className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Enter the 6-digit code sent to ",e.jsx("span",{className:"text-gold font-medium",children:s}),"."]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:"Verification code"}),e.jsx("input",{inputMode:"numeric",value:d,onChange:t=>b(t.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"______",maxLength:6,className:"w-full rounded-xl border border-input bg-secondary/50 px-3 py-2.5 text-center text-2xl font-mono tracking-[0.5em] focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"})]}),l&&e.jsx("p",{className:"text-xs text-red-400",children:l}),e.jsx("button",{type:"submit",disabled:o,className:"w-full gold-gradient text-black font-semibold rounded-xl px-4 py-2.5 text-sm transition-transform active:scale-[0.98] hover:brightness-110 disabled:opacity-60",children:o?"Verifying…":"Verify & continue"}),e.jsx("button",{type:"button",onClick:x,disabled:o,className:"w-full text-xs text-muted-foreground hover:text-[hsl(var(--gold))] transition-colors",children:"Didn't get it? Resend code"})]})]})})}export{E 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.