PageSourceSearch

https://www.interviewghost.ai/assets/VerifyEmail-CwChNmN2.js

js interviewghost.ai collected 2026-10-02 01:12:01 UTC 9,765 bytes, 1 lines download raw bytes

1import{r as c,j as e}from"./react-vendor-CJf-GESP.js";import{E as W,u as z,c as H,N as Y,F as Z,i as I,t as q,A as g,_ as J}from"./index-rYd6JV6i.js";const y="b2c_pending_verify_email",L=12e4,f=6;function Q(){var d;try{return((d=sessionStorage.getItem(y))==null?void 0:d.trim())||""}catch{return""}}function U(d){try{sessionStorage.setItem(y,d.trim())}catch{}}function V(){try{sessionStorage.removeItem(y)}catch{}}function X(d){const r=d.trim(),o=r.indexOf("@");if(o<=0)return r||"your email";const l=r.slice(0,o),i=r.slice(o+1);return i?l.length<=2?`${l[0]??""}••••••@${i}`:l.length<=4?`${l.slice(0,1)}••••••${l.slice(-1)}@${i}`:`${l.slice(0,2)}••••••${l.slice(-2)}@${i}`:r}const ne=()=>{const{state:d}=W(),r=d||{},o=z(),{toast:l}=H(),i=c.useMemo(()=>(typeof r.email=="string"?r.email.trim():"")||Q(),[r.email]),[h,x]=c.useState(()=>Array(f).fill("")),[v,w]=c.useState(!1),[b,N]=c.useState(!1),[j,E]=c.useState(()=>typeof r.resendAvailableAt=="number"&&r.resendAvailableAt>Date.now()?r.resendAvailableAt:r.fromSignup?Date.now()+L:0),[p,$]=c.useState(0),k=c.useRef([]),D=h.join(""),S=X(i);c.useEffect(()=>{i&&U(i)},[i]),c.useEffect(()=>{const t=()=>{const n=Math.max(0,Math.ceil((j-Date.now())/1e3));$(n)};t();const s=window.setInterval(t,500);return()=>window.clearInterval(s)},[j]);const u=t=>{const s=k.current[t];s&&(s.focus(),s.select())},F=(t,s)=>{const n=s.replace(/\D/g,"");if(!n){x(a=>{const m=[...a];return m[t]="",m});return}if(n.length>1){const a=n.slice(0,f).split("");x(m=>{const R=[...m];return a.forEach((K,_)=>{t+_<f&&(R[t+_]=K)}),R}),u(Math.min(t+a.length,f-1));return}x(a=>{const m=[...a];return m[t]=n,m}),t<f-1&&u(t+1)},P=(t,s)=>{s.key==="Backspace"?(h[t]?x(n=>{const a=[...n];return a[t]="",a}):t>0&&(u(t-1),x(n=>{const a=[...n];return a[t-1]="",a})),s.preventDefault()):s.key==="ArrowLeft"&&t>0?(u(t-1),s.preventDefault()):s.key==="ArrowRight"&&t<f-1&&(u(t+1),s.preventDefault())},M=async t=>{if(t.preventDefault(),!i){l({title:"Email missing",description:"We need your email to verify. Please sign up or sign in again.",variant:"destructive"}),o("/signup",{replace:!0});return}const s=D.trim();if(!/^\d{6}$/.test(s)){l({title:"Invalid code",description:"Enter the 6-digit code from your email.",variant:"destructive"});return}w(!0);try{const n=await I.verifyEmail(s);q("CompleteRegistration",{content_name:"InterviewGhost Candidate Account",status:!0,method:"email"}),V(),l({title:"Email verified",description:g(n,"Email Verified Successfully"),variant:"success"}),o("/signin",{replace:!0,state:{email:i,fromVerify:!0}})}catch(n){l({title:"Verification failed",description:g(n,"Invalid or Expired Code"),variant:"destructive"})}finally{w(!1)}},A=async()=>{if(!i){l({title:"Email missing",description:"We need your email to resend the code. Please sign up again.",variant:"destructive"}),o("/signup",{replace:!0});return}if(!(p>0||b)){N(!0);try{const t=await I.resendVerification(i);E(Date.now()+L),l({title:"Code sent",description:g(t,"New verification code sent successfully"),variant:"success"})}catch(t){const s=g(t),n=J(t);n!=null&&n>0&&E(Date.now()+n*1e3);const a=s.toLowerCase();if(a.includes("already verified")){V(),l({title:"Already verified",description:s,variant:"success"}),o("/signin",{replace:!0,state:{email:i}});return}if(a.includes("not found")||a.includes("register first")){l({title:"No account found",description:s,variant:"destructive"}),o("/signup",{replace:!0});return}if(n!=null&&n>0){l({title:"Please wait",description:s,variant:"destructive"});return}l({title:"Couldn't resend code",description:s,variant:"destructive"})}finally{N(!1)}}},O=/^\d{6}$/.test(D)&&!v,B=!!i&&p===0&&!b,C=b?"Sending…":p>0?`Resend in ${p}s`:"Resend Code",T=e.jsx("div",{className:"flex items-center gap-2 md:gap-3",children:h.map((t,s)=>e.jsx("input",{ref:n=>{k.current[s]=n},type:"text",inputMode:"numeric",autoComplete:s===0?"one-time-code":"off",maxLength:1,value:t,onChange:n=>F(s,n.target.value),onKeyDown:n=>P(s,n),onFocus:n=>n.target.select(),onPaste:n=>{n.preventDefault();const a=n.clipboardData.getData("text").replace(/\D/g,"");a&&F(0,a)},disabled:v,"aria-label":`Digit ${s+1} of verification code`,className:"h-11 w-11 shrink-0 rounded-lg border border-[#B1BFE1] bg-white text-center font-sans text-[18px] font-medium text-black outline-none focus:border-[#8715FF] focus:ring-1 focus:ring-[#8715FF] disabled:opacity-60"},s))}),G=e.jsxs("form",{onSubmit:M,className:"flex w-full max-w-[520px] flex-col gap-5 md:gap-6",children:[e.jsxs("div",{className:"flex w-fit max-w-full flex-col gap-5 md:gap-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1 block font-sans text-[14px] font-normal leading-[26px] text-black md:text-[17px]",children:["Verification code",e.jsx("span",{className:"text-black",children:"*"})]}),T]}),e.jsx("button",{type:"submit",disabled:!O,className:"flex w-full shrink-0 items-center justify-center rounded-lg bg-[#8715FF] py-[7px] font-sans text-[18px] font-medium leading-[30px] text-white shadow-[0_4px_12px_0_rgba(0,0,0,0.15)] disabled:bg-[#D9D9D9] disabled:text-[#9B9B9B] disabled:shadow-none md:text-[22px]",children:v?"Verifying...":"
1Verify Email"}),e.jsxs("div",{className:"hidden w-0 min-w-full flex-col gap-3 md:flex",children:[e.jsxs("p",{className:"w-full text-center font-['Roboto',sans-serif] text-[18px] font-normal leading-[30px] tracking-[0.18px] text-[#778199]",style:{fontFeatureSettings:"'liga' off, 'clig' off"},children:["Didn't receive the code?"," ",e.jsx("button",{type:"button",onClick:()=>{A()},disabled:!B,className:"text-[20px] tracking-[0.2px] text-[#8715FF] hover:underline disabled:cursor-not-allowed disabled:text-[#9B9B9B] disabled:no-underline",children:C})]}),e.jsxs("p",{className:"w-full text-center font-['Roboto',sans-serif] text-[18px] font-normal leading-[30px] tracking-[0.18px] text-[#778199]",style:{fontFeatureSettings:"'liga' off, 'clig' off"},children:["Already verified?"," ",e.jsx("button",{type:"button",onClick:()=>o("/signin",{replace:!0,state:i?{email:i}:void 0}),className:"text-[20px] tracking-[0.2px] text-[#8715FF] hover:underline",children:"Sign In"})]}),e.jsx("div",{className:"my-1 h-px w-full bg-[#E5E7EB]"}),e.jsxs("p",{className:"w-max max-w-none whitespace-nowrap text-left font-sans text-[18px] font-normal leading-[26px] text-[#122B31]",children:["Not a candidate?"," ",e.jsx("button",{type:"button",onClick:()=>o("/hr/login"),className:"font-medium text-[#F56000] hover:underline",children:"Switch to company login"})]})]})]}),e.jsxs("div",{className:"flex w-full flex-col items-center gap-4 md:hidden",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-sans text-[16px] font-normal leading-6 text-[#122B31]",children:"Didn't receive the code?"}),e.jsx("button",{type:"button",onClick:()=>{A()},disabled:!B,className:"font-sans text-[17px] font-medium leading-6 text-[#8715FF] hover:underline disabled:cursor-not-allowed disabled:text-[#9B9B9B] disabled:no-underline",children:C})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-sans text-[16px] font-normal leading-6 text-[#122B31]",children:"Already verified?"}),e.jsx("button",{type:"button",onClick:()=>o("/signin",{replace:!0,state:i?{email:i}:void 0}),className:"font-sans text-[17px] font-medium leading-6 text-[#8715FF] hover:underline",children:"Sign In"})]}),e.jsx("div",{className:"h-px w-full max-w-[327px] bg-[#E5E7EB]"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-sans text-[16px] font-normal leading-[26px] text-[#122B31]",children:"Not a candidate?"}),e.jsx("button",{type:"button",onClick:()=>o("/hr/login"),className:"font-sans text-[17px] font-medium leading-[26px] text-[#F56000] hover:underline",children:"Switch to company login"})]})]})]});return e.jsxs("div",{className:"flex min-h-screen flex-col bg-white",children:[e.jsx(Y,{comfortZoom:!0}),e.jsx("div",{className:"flex flex-1 flex-col pt-[calc(3.5rem*0.8)] md:pt-[calc(81px*0.8)]",children:e.jsxs("div",{className:"auth-page-comfort-zoom flex flex-1 flex-col origin-top",style:{zoom:.9},children:[e.jsx("main",{className:"flex-1",children:e.jsx("section",{className:"mx-auto w-full max-w-[1920px] self-stretch px-6 pb-20 pt-8 md:px-8 md:pb-24 md:pt-9 lg:px-16 xl:px-[100px] xl:pb-32",children:e.jsxs("div",{className:"grid w-full grid-cols-1 items-stretch gap-y-6 md:grid-cols-[minmax(0,1fr)_minmax(280px,min(40%,640px))] md:gap-x-10 lg:gap-x-12",children:[e.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-6 md:gap-8",children:[e.jsxs("div",{className:"w-full min-w-0",children:[e.jsx("h1",{className:"hidden font-normal leading-normal tracking-[0.12px] text-[#2C045D] md:block md:max-w-[831px] md:text-[clamp(28px,2.8vw,48px)]",style:{fontFamily:'"PT Serif Caption", Georgia, serif'},children:"Verify your email"}),e.jsx("h1",{className:"self-stretch font-sans text-[28px] font-medium leading-9 tracking-[0.28px] text-[#2C045D] md:hidden",children:"Verify your email"}),e.jsxs("p",{className:"mt-3 hidden max-w-[832px] font-sans text-[clamp(16px,1.4vw,24px)] font-normal leading-[1.25] text-[#484848] md:block xl:leading-[30px]",children:["Enter the 6-digit code we sent to, “",S,"”"]}),e.jsxs("p",{className:"mt-3 self-stretch font-sans text-[16px] font-normal leading-[22px] text-[#484848] md:hidden",children:["Enter the 6-digit code we sent to",e.jsx("br",{}),S]})]}),G]}),e.jsx("div",{className:"relative hidden min-h-0 w-full md:block",children:e.jsx("img",{src:"/signin_images/candidate-signin-geometric.png",alt:"",className:"absolute inset-0 h-full w-full rounded-[24px] object-cover object-center opacity-50"})})]})})}),e.jsx("div",{className:"hidden md:block",children:e.jsx(Z,{hideBanner:!0})})]})})]})};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.