PageSourceSearch

https://landledger.co/assets/signup-BjEV4Lul.js

js landledger.co collected 2026-10-04 06:55:03 UTC 9,673 bytes, 1 lines download raw bytes

1import{u as Q,r as a,j as e,B as b,L as O,a as V,t as o}from"./index-CudHG6B4.js";import{I as x}from"./input-kx1YXBs7.js";import{L as u}from"./label-B2onvOiF.js";import{P as Y,g as Z}from"./PasswordStrengthMeter-C0b97wPh.js";import{a as ee,S as s,M as te}from"./signupForm-CjkC9kZ5.js";import{A as se}from"./arrow-left-lxn-dpfG.js";import{E as q}from"./eye-off-Cm4tYUKG.js";import{E as A}from"./eye-uFk1fLjc.js";import{C as ae}from"./circle-check-CTosiqnS.js";import{C as re}from"./circle-x-BHDARfrW.js";import"./circle-C1ccQMbh.js";async function ie(h,r){const i=await fetch("/api/auth/resend-verification",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:h,signupReturnTo:r})}),p=await i.json();if(!i.ok)throw new Error(p.message||"Failed to resend");return p.message}function Ne(){const[,h]=Q(),r=ee(window.location.search),{destination:i}=r,p=i.startsWith("/borrower/verify/");a.useEffect(()=>{(!r.hasSignupContext||r.destination==="/apply")&&h("/welcome")},[r.destination,r.hasSignupContext,h]);const[C,N]=a.useState("email"),[n,B]=a.useState(s.email.initialValue),[l,D]=a.useState(s.password.initialValue),[c,$]=a.useState(s.confirmPassword.initialValue),[g,J]=a.useState(s.firstName.initialValue),[y,M]=a.useState(s.lastName.initialValue),[S,P]=a.useState(!1),[j,G]=a.useState(!1),[w,U]=a.useState(!1),[m,k]=a.useState(""),[d,E]=a.useState(""),[F,L]=a.useState(!1),[W,T]=a.useState(!1),_=async()=>{L(!0),T(!1);try{await ie(n,i!=="/welcome"?i:void 0),T(!0)}catch(t){o.error("Error",{description:t.message})}finally{L(!1)}},z=t=>{if(t.preventDefault(),!n){o.error("Email required",{description:"Please enter your email address"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)){o.error("Invalid email",{description:"Please enter a valid email address"});return}N("password")},H=async t=>{t.preventDefault();const R=g.trim(),X=y.trim();let v=!0;if(R||(k("First name is required"),v=!1),X||(E("Last name is required"),v=!1),!v)return;const I=Z(l);if(I){o.error("Password requirements not met",{description:I.message});return}if(!c){o.error("Password confirmation required",{description:"Please re-enter your password"});return}if(l!==c){o.error("Passwords don't match",{description:"Please make sure both passwords match"});return}P(!0);try{const f=await fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:n,password:l,firstName:g.trim(),lastName:y.trim(),accountType:r.accountType,signupReturnTo:i!=="/welcome"?i:void 0})}),K=await f.json();if(!f.ok)throw new Error(K.message||"Registration failed");N("confirmed")}catch(f){o.error("Registration failed",{description:f.message})}finally{P(!1)}};return e.jsx("main",{className:"flex-1 flex items-center justify-center px-6 py-20 md:py-24",children:e.jsx("div",{className:"w-full max-w-md",children:C==="email"?e.jsxs("div",{className:"space-y-8",children:[e.jsx("div",{className:"text-center space-y-2",children:e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Sign up with Land Ledger"})}),e.jsxs("form",{onSubmit:z,className:"space-y-4",autoComplete:"off","data-testid":"form-email-signup",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"email",className:"text-sm font-medium text-gray-900",children:"Email"}),e.jsx(x,{id:"email",name:s.email.name,type:"email",autoComplete:s.email.autoComplete,autoCapitalize:"none",spellCheck:!1,placeholder:"[email protected]",value:n,onChange:t=>B(t.target.value),className:"h-12 text-base",autoFocus:!0,"data-testid":"input-email"})]}),e.jsx(b,{type:"submit",className:"w-full h-12 bg-brand hover:bg-brand-hover active:bg-brand-pressed text-white font-semibold text-base","data-testid":"button-continue",children:"Continue"})]}),e.jsx("div",{className:"text-center",children:e.jsxs("p",{className:"text-sm text-gray-600",children:["Already have an account?"," ",e.jsx(O,{href:r.signInHref,className:"text-brand hover:text-brand-hover font-medium",children:"Sign in"})]})})]}):C==="password"?e.jsxs("div",{className:"space-y-8",children:[e.jsxs("button",{onClick:()=>N("email"),className:"flex items-center text-gray-600 hover:text-gray-900 transition-colors","data-testid":"button-back",children:[e.jsx(se,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Create your account"}),e.jsx("p",{className:"text-gray-600",children:n})]}),e.jsxs("form",{onSubmit:H,className:"space-y-4",autoComplete:"off","data-testid":"form-password-signup",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"firstName",className:"text-sm font-medium text-gray-900",children:"First Name"}),e.jsx(x,{id:"firstName",name:s.firstName.name,type:"text",autoComplete:s.firstName.autoComplete,placeholder:"John",value:g,onChange:t=>{J(t.target.value),k("")},className:`h-12 text-base${m?" border-red-500 focus-visible:ring-red-500":""}`,"aria-invalid":m?"true":void 0,"aria-describedby":m?"firstName-error":void 0,"data-testid":"input-firstname"}),m&&e.jsx("p",{id:"firstName-error",className:"text-sm text-red-600",role:"alert",children:m})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"lastName",className:"text-sm font-medium text-gray-900",children:"Last Name"}),e.jsx(x,{id:"lastName",name:s.lastName.name,type:"text",autoComplete:s.lastName.autoComplete,placeholder:"Doe",value:y,onChange:t=>{M(t.target.value),E("")},className:`h-12 text-base${d?" border-red-500 focus-visible:ring-red-500":""}`,"aria-invalid":d?"true":void 0,"aria-describedby":d?"lastName-error":void 0,"data-testid":"input-lastname"}),d&&e.jsx("p",{id:"lastName-error",className:"text-sm text-red-600",role:"alert",children:d})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"password",className:"text-sm font-medium text-gray-900",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(x,{id:"password",name:s.password.name,type:j?"text":"password",autoComplete:s.password.autoComplete,placeholder:"At least 12 characters",value:l,onCh
1ange:t=>D(t.target.value),className:"h-12 text-base pr-12",autoFocus:!0,"data-testid":"input-password"}),e.jsx("button",{type:"button",onClick:()=>G(!j),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700 transition-colors","data-testid":"button-toggle-password",children:j?e.jsx(q,{className:"h-5 w-5"}):e.jsx(A,{className:"h-5 w-5"})})]}),e.jsx(Y,{password:l,className:"pt-1"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"confirmPassword",className:"text-sm font-medium text-gray-900",children:"Confirm Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(x,{id:"confirmPassword",name:s.confirmPassword.name,type:w?"text":"password",autoComplete:s.confirmPassword.autoComplete,placeholder:"Confirm your password",value:c,onChange:t=>$(t.target.value),className:"h-12 text-base pr-12","data-testid":"input-confirm-password"}),e.jsx("button",{type:"button",onClick:()=>U(!w),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700 transition-colors","data-testid":"button-toggle-confirm-password",children:w?e.jsx(q,{className:"h-5 w-5"}):e.jsx(A,{className:"h-5 w-5"})})]}),c.length>0&&(l===c?e.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-green-600",children:[e.jsx(ae,{className:"h-4 w-4 shrink-0"}),"Passwords match"]}):e.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-red-500",children:[e.jsx(re,{className:"h-4 w-4 shrink-0"}),"Passwords don't match"]}))]}),e.jsx(b,{type:"submit",className:"w-full h-12 bg-brand hover:bg-brand-hover active:bg-brand-pressed text-white font-semibold text-base",disabled:S,"data-testid":"button-create-account",children:S?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating account..."]}):"Create account"})]}),e.jsxs("p",{className:"text-xs text-gray-500 text-center",children:["By creating an account, you agree to our"," ",e.jsx("a",{href:"#",className:"text-brand hover:text-brand-hover",children:"Terms of Service"})," ","and"," ",e.jsx("a",{href:"#",className:"text-brand hover:text-brand-hover",children:"Privacy Policy"})]})]}):e.jsxs("div",{className:"space-y-6 text-center",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-16 h-16 rounded-full bg-brand/10 flex items-center justify-center",children:e.jsx(te,{className:"h-8 w-8 text-brand"})})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Check your email"}),e.jsx("p",{className:"text-gray-600",children:"We sent a verification link to"}),e.jsx("p",{className:"font-semibold text-gray-900",children:n}),e.jsxs("p",{className:"text-gray-600 text-sm",children:["Click the link in that email to activate your account.",p&&" Then sign in to return to the secure loan verification step."]})]}),e.jsx("p",{className:"text-xs text-gray-400",children:"The link expires in 24 hours."}),e.jsxs("div",{className:"pt-2 space-y-3",children:[W?e.jsx("p",{className:"text-sm text-green-600 font-medium",children:"Verification email resent. Check your inbox."}):e.jsx(b,{variant:"outline",className:"w-full",onClick:_,disabled:F,children:F?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Resend verification email"}),e.jsxs("p",{className:"text-xs text-gray-400",children:["Already verified?"," ",e.jsx(O,{href:`/login?returnTo=${encodeURIComponent(i)}`,className:"text-brand hover:text-brand-hover font-medium",children:"Sign in"})]})]})]})})})}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.