PageSourceSearch

https://rentgain.ai/assets/LoginPage-CgqjMNzJ.js

js rentgain.ai collected 2026-10-05 12:27:38 UTC 5,372 bytes, 1 lines download raw bytes

1import{r as i,j as e}from"./vendor-react-BmaOEVXd.js";import{G as S,A as g,a as E,t as n}from"./translateApiError-xF1QNHqS.js";import{A as j}from"./AuthInput-C3cWkLQq.js";import{ab as T,g as C,ac as P,w as R,S as F}from"./index-DaR3WIIn.js";import{M as G}from"./MobileAuthScreen-DMULSrad.js";import{b as I}from"./vendor-router-YJ1kuUK4.js";import{u as M}from"./vendor-i18n-DFLJMoQz.js";import{M as H}from"./mail-DWxNBylI.js";import{E as B}from"./eye-off-Bp9PERsR.js";import{E as O}from"./eye-Blb9mCoc.js";import{L as q}from"./lock-BggU57ti.js";import{m as b}from"./vendor-motion-2QGaoAUv.js";import"./index.es-DWwTiEcw.js";import"./vendor-ui-DP4RxKPZ.js";import"./vendor-query-CvUMyKt2.js";import"./vendor-firebase--9_-N0hd.js";import"./vendor-supabase-B_SzD5j0.js";const re=()=>{const r=I(),{login:w}=T(),{toast:u}=C(),{t}=M(),[l,v]=i.useState(""),[c,y]=i.useState(""),[d,N]=i.useState(!1),[k,h]=i.useState(!1),[m,a]=i.useState({}),p=async o=>{if(o.preventDefault(),a({}),!l.trim()){a(s=>({...s,email:t("auth.emailRequired")}));return}if(!c.trim()){a(s=>({...s,password:t("auth.passwordRequired")}));return}h(!0);try{const s=await w({email:l,password:c});if(s.success)s.needsOnboarding?r("/onboarding"):(u({title:t("auth.welcomeBackToast"),description:t("auth.loginSuccess")}),r("/dashboard"));else if(s.error)if(s.error.email||s.error.password)a({email:n(s.error.email),password:n(s.error.password)});else if(s.error.general)a({password:n(s.error.general)});else{const L=Object.values(s.error).map(A=>n(A)).join(", ")||t("auth.apiErrors.loginFailed");a({password:L})}}catch(s){console.error("[LoginPage] Unexpected error:",s),u({title:t("common.error"),description:t("common.somethingWentWrong"),variant:"destructive"})}finally{h(!1)}},x=()=>a({}),f=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx(j,{label:t("auth.emailAddress"),type:"email",placeholder:t("auth.enterEmail"),value:l,onChange:o=>{v(o.target.value),x()},error:m.email,icon:e.jsx(H,{className:"h-5 w-5"}),autoComplete:"email"}),e.jsxs("div",{children:[e.jsx(j,{label:t("auth.password"),type:d?"text":"password",placeholder:t("auth.passwordPlaceholder"),value:c,onChange:o=>{y(o.target.value),x()},error:m.password,icon:e.jsx(q,{className:"h-5 w-5"}),rightIcon:e.jsx("button",{type:"button",onClick:()=>N(!d),className:"p-1 rounded-lg hover:bg-primary/10 transition-colors",children:d?e.jsx(B,{className:"h-5 w-5"}):e.jsx(O,{className:"h-5 w-5"})}),autoComplete:"current-password"}),!m.password&&e.jsx("p",{className:"mt-1.5 hidden pl-1 text-xs text-muted-foreground max-md:block",children:t("auth.atLeast8Chars")})]})]}),e.jsx("div",{className:"flex justify-end -mt-1",children:e.jsx("button",{type:"button",onClick:()=>r("/forgot-password"),className:"inline-flex min-h-11 items-center px-1 text-sm font-bold text-[color:var(--cta-accent)] transition-opacity hover:opacity-80",children:t("auth.forgotPassword")})}),e.jsx(S,{type:"submit",isLoading:k,children:t("auth.signIn")})]});return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"md:hidden",children:e.jsx(G,{backTo:"/",headlineLead:t("auth.loginHeadlineLead"),headlineAccent:t("auth.loginHeadlineAccent"),description:t("auth.loginIntroDes"),children:e.jsxs("form",{onSubmit:p,className:"mobile-auth-form space-y-4",children:[f,e.jsxs("div",{className:"mobile-auth-footer flex items-center justify-center",style:{marginTop:"calc(24 * var(--dp))"},children:[e.jsx("span",{children:t("auth.newToRentGain")}),e.jsx(g,{text:"",linkText:t("auth.createAccount"),onLinkClick:()=>r("/register")})]})]})})}),e.jsx("div",{className:"hidden md:block",children:e.jsx(E,{variant:"login",children:e.jsxs("form",{onSubmit:p,className:"space-y-6",children:[!P()&&e.jsxs(b.button,{type:"button",onClick:()=>r("/"),initial:{opacity:0,x:-10},animate:{opacity:1,x:0},whileHover:{x:-4},className:"flex items-center gap-1.5 text-sm font-semibold text-muted-foreground transition-colors hover:text-primary group",children:[e.jsx(R,{className:"h-4 w-4 transition-transform group-hover:-translate-x-1"}),t("common.backToHome")]}),e.jsxs(b.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:.1},className:"text-left space-y-3",children:[e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold",style:{backgroundColor:"color-mix(in srgb, var(--cta-accent) 14%, transparent)"},children:[e.jsx(F,{className:"w-3.5 h-3.5 text-[color:var(--cta-accent)]"}),e.jsx("span",{className:"font-semibold text-[color:var(--cta-accent)]",children:t("auth.welcomeToRentGain")})]}),e.jsx("h1",{className:"text-3xl font-bold text-foreground tracking-tight",children:t("auth.welcomeBack")}),e.jsx("p",{className:"text-muted-foreground text-base leading-relaxed",children:t("auth.loginSubtitle")})]}),e.jsx("div",{className:"pt-2",children:f}),e.jsxs("div",{className:"relative py-4",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-border/50"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"auth-divider-label bg-white px-4 text-muted-foreground/60 font-medium tracking-wider",children:t("auth.newToRentGain")})})]}),e.jsx(g,{text:"",linkText:t("auth.createAccount"),onLinkClick:()=>r("/register")})]})})})]})};export{re 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.